Skip to content

Rose::StringUtility::stripPathFromFileName

Returns the last component of a path in a filesystem.

Synopsis

Declared in <src/Rose/StringUtility/FileUtility.h>

[[visibility("default")]]
std::string
stripPathFromFileName(std::string const& fileNameWithPath);

Description

Removes the "path" part of a "filename" (if there is one) and returns just the file name.

Terms are loosely defined and not likely to work for non-POSIX systems; consider using std::filesystem instead.

Return Value

Last path component.

Parameters

Name Description
fileNameWithPath Path-like string.

Created with MrDocs