mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 11:05:46 +00:00
file_util: Use enum instead of bool for specifing path behavior
This commit is contained in:
parent
55190386b4
commit
b43d01f09b
4 changed files with 37 additions and 24 deletions
|
@ -182,9 +182,12 @@ std::vector<T> SliceVector(const std::vector<T>& vector, size_t first, size_t la
|
|||
return std::vector<T>(vector.begin() + first, vector.begin() + first + last);
|
||||
}
|
||||
|
||||
enum class DirectorySeparator { ForwardSlash, BackwardSlash, PlatformDefault };
|
||||
|
||||
// Removes trailing slash, makes all '\\' into '/', and removes duplicate '/'. Makes '/' into '\\'
|
||||
// if windows and with_platform_slashes is true.
|
||||
std::string SanitizePath(std::string_view path, bool with_platform_slashes = false);
|
||||
// depending if directory_separator is BackwardSlash or PlatformDefault and running on windows
|
||||
std::string SanitizePath(std::string_view path,
|
||||
DirectorySeparator directory_separator = DirectorySeparator::ForwardSlash);
|
||||
|
||||
// simple wrapper for cstdlib file functions to
|
||||
// hopefully will make error checking easier
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue