mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 21:28:51 +00:00
Common/StringUtil: Add convenience function for converting paths to use forward slashes on Windows.
This commit is contained in:
parent
2081e2f2a1
commit
b1d1f2aa06
2 changed files with 25 additions and 0 deletions
|
@ -335,6 +335,23 @@ bool SplitPath(std::string_view full_path, std::string* path, std::string* filen
|
|||
return true;
|
||||
}
|
||||
|
||||
void UnifyPathSeparators(std::string& path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
for (char& c : path)
|
||||
{
|
||||
if (c == '\\')
|
||||
c = '/';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string WithUnifiedPathSeparators(std::string path)
|
||||
{
|
||||
UnifyPathSeparators(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string PathToFileName(std::string_view path)
|
||||
{
|
||||
std::string file_name, extension;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue