BloombergLP::bdls::FilesystemUtil::makeUnsafeTemporaryFilename

Construct a file name by appending an automatically-generated suffix to the specified prefix. The file name constructed is assigned to the specified outPath. Note that this function is called "unsafe" because a file with the resulting name may be created by another program before the caller has opportunity to use the name, which could be a security vulnerability, and a file with the given name may already exist where you mean to put it. Note that the suffix is hashed from environmental details, including any pre-existing value of outPath so that if a resulting name is unsuitable (e.g. the file exists) this function may simply be called again, pointing to its previous result, to get a new, probably different name.

Synopsis

Declared in <bdls_filesystemutil.h>

static
void
makeUnsafeTemporaryFilename(
    bsl::string* outPath,
    std::string_view const& prefix);