BloombergLP::bdls::FilesystemUtil::visitPaths

Call the specified visitor function object for each path in the filesystem matching the specified pattern. Return the number of paths visited on success, and a negative value otherwise. Note that if visitor deletes files or directories during the search, visitor may subsequently be called with paths which have already been deleted, so must be prepared for this event. Also note that there is no guarantee as to the order in which paths will be visited. See findMatchingPaths for a discussion of how pattern is interpreted. Also note that . and .. are never matched by wild cards. The parameterized STRING_TYPE must be one of bsl::string, std::string, std::pmr::string (if supported), bsl::string_view, or bslstl::StringRef.

Synopsis

Declared in <bdls_filesystemutil.h>

static
int
visitPaths(
    char const* pattern,
    bsl::function<void(char const*)> const& visitor);

Description

IBM-SPECIFIC WARNING: This function is not thread-safe. The AIX implementation of the system glob function can temporarily change the working directory of the entire program, causing attempts in other threads to open files with relative path names to fail.