From b48fe786ebbcd425eb17e278f5169b5a86e67699 Mon Sep 17 00:00:00 2001 From: emb <> Date: Mon, 3 Aug 2015 23:00:04 -0500 Subject: [PATCH] Fixing windows path issues --- RetroFE/Source/Utility/Utils.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/RetroFE/Source/Utility/Utils.cpp b/RetroFE/Source/Utility/Utils.cpp index ab3b6c6..e41cb42 100644 --- a/RetroFE/Source/Utility/Utils.cpp +++ b/RetroFE/Source/Utility/Utils.cpp @@ -194,8 +194,11 @@ void Utils::replaceSlashesWithUnderscores(std::string &content) std::string Utils::getDirectory(std::string filePath) { - std::string directory = filePath; +#ifdef WIN32 + filePath = Utils::replace(filePath, "/", "\\"); +#endif + std::string directory = filePath; const size_t last_slash_idx = filePath.rfind(pathSeparator); if (std::string::npos != last_slash_idx) { @@ -207,6 +210,9 @@ std::string Utils::getDirectory(std::string filePath) std::string Utils::getParentDirectory(std::string directory) { +#ifdef WIN32 + directory = Utils::replace(directory, "/", "\\"); +#endif size_t last_slash_idx = directory.find_last_of(pathSeparator); if(directory.length() - 1 == last_slash_idx) { @@ -225,6 +231,9 @@ std::string Utils::getParentDirectory(std::string directory) std::string Utils::getFileName(std::string filePath) { +#ifdef WIN32 + filePath = Utils::replace(filePath, "/", "\\"); +#endif std::string filename = filePath;