summaryrefslogtreecommitdiff
path: root/Source/Core/Common/StringUtil.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2022-06-13 20:18:36 -0400
committerGitHub <noreply@github.com>2022-06-13 20:18:36 -0400
commit9315ac7071f4bde287efe0d02d5234dfb78cef3a (patch)
treeeda63a1c38c19f2f7fad1acc2e803954eb4a23be /Source/Core/Common/StringUtil.cpp
parentf96e91119accffe1bed892a6419580cffbcec099 (diff)
parent4fd18cf2074da4babd340a306eb66eb762312182 (diff)
Merge pull request #10587 from AdmiralCurtiss/memcard-path-unify
Raw Memory Card Path handling unification and consistency fixes.
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
-rw-r--r--Source/Core/Common/StringUtil.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp
index a752ab0e10..c498e261fd 100644
--- a/Source/Core/Common/StringUtil.cpp
+++ b/Source/Core/Common/StringUtil.cpp
@@ -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;