FileSystem: Migrate component extractors to std::string_view

This commit is contained in:
Connor McLaughlin
2021-02-16 00:48:14 +10:00
parent 8c7aec2edf
commit cacf12c209
6 changed files with 38 additions and 54 deletions

View File

@ -143,16 +143,16 @@ void SanitizeFileName(String& Destination, bool StripSlashes = true);
bool IsAbsolutePath(const std::string_view& path);
/// Replaces the extension of a filename with another.
std::string ReplaceExtension(std::string_view path, std::string_view new_extension);
std::string ReplaceExtension(const std::string_view& path, const std::string_view& new_extension);
/// Returns the directory component of a filename.
std::string GetPathDirectory(const char* path);
std::string_view GetPathDirectory(const std::string_view& path);
/// Returns the filename component of a filename.
std::string_view GetFileNameFromPath(const char* path);
std::string_view GetFileNameFromPath(const std::string_view& path);
/// Returns the file title (less the extension and path) from a filename.
std::string_view GetFileTitleFromPath(const char* path);
std::string_view GetFileTitleFromPath(const std::string_view& path);
/// Returns a list of "root directories" (i.e. root/home directories on Linux, drive letters on Windows).
std::vector<std::string> GetRootDirectoryList();