From 8b39bca0111eecd49253b2180b8d28890b8f9db1 Mon Sep 17 00:00:00 2001 From: emb <> Date: Mon, 3 Aug 2015 21:32:01 -0500 Subject: [PATCH 1/4] Delaying %ITEM_COLLECTION_NAME% processing for launchers --- RetroFE/Source/Database/Configuration.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/RetroFE/Source/Database/Configuration.cpp b/RetroFE/Source/Database/Configuration.cpp index e95a196..73c29fb 100644 --- a/RetroFE/Source/Database/Configuration.cpp +++ b/RetroFE/Source/Database/Configuration.cpp @@ -130,10 +130,13 @@ bool Configuration::parseLine(std::string collection, std::string keyPrefix, std key = trimEnds(key); - - value = line.substr(position + delimiter.length(), line.length()); - value = trimEnds(value); - value = Utils::replace(value, "%ITEM_COLLECTION_NAME%", collection); + // only overwrite the collection name if we know it. We could be parsing a launcher configuration + if(collection != "") + { + value = line.substr(position + delimiter.length(), line.length()); + value = trimEnds(value); + value = Utils::replace(value, "%ITEM_COLLECTION_NAME%", collection); + } properties_.insert(PropertiesPair(key, value)); From b4f1cb259e16e3b11cc6ed4b2f917016b69ba6cc Mon Sep 17 00:00:00 2001 From: emb <> Date: Mon, 3 Aug 2015 21:39:42 -0500 Subject: [PATCH 2/4] Fix variables not being set in config when no collection was being passed --- RetroFE/Source/Database/Configuration.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RetroFE/Source/Database/Configuration.cpp b/RetroFE/Source/Database/Configuration.cpp index 73c29fb..f385235 100644 --- a/RetroFE/Source/Database/Configuration.cpp +++ b/RetroFE/Source/Database/Configuration.cpp @@ -130,11 +130,12 @@ bool Configuration::parseLine(std::string collection, std::string keyPrefix, std key = trimEnds(key); + value = line.substr(position + delimiter.length(), line.length()); + value = trimEnds(value); + // only overwrite the collection name if we know it. We could be parsing a launcher configuration if(collection != "") { - value = line.substr(position + delimiter.length(), line.length()); - value = trimEnds(value); value = Utils::replace(value, "%ITEM_COLLECTION_NAME%", collection); } From af820bffb3cd28e67e3a4ed2f193d8e2ddf299f7 Mon Sep 17 00:00:00 2001 From: emb <> Date: Mon, 3 Aug 2015 22:36:17 -0500 Subject: [PATCH 3/4] Fix for paths starting with // or \\ in windows --- RetroFE/Source/Database/Configuration.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/RetroFE/Source/Database/Configuration.cpp b/RetroFE/Source/Database/Configuration.cpp index f385235..3cc21ae 100644 --- a/RetroFE/Source/Database/Configuration.cpp +++ b/RetroFE/Source/Database/Configuration.cpp @@ -305,9 +305,11 @@ std::string Configuration::convertToAbsolutePath(std::string prefix, std::string } // check to see if it is already an absolute path - if((first != Utils::pathSeparator) && - //(first != '.') && - (second != ':')) +#ifdef WIN32 + if((first != '\\') && (first != '/') && (second != ':')) +#else + if(first != Utils::pathSeparator) +#endif { path = Utils::combinePath(prefix, path); } From b48fe786ebbcd425eb17e278f5169b5a86e67699 Mon Sep 17 00:00:00 2001 From: emb <> Date: Mon, 3 Aug 2015 23:00:04 -0500 Subject: [PATCH 4/4] 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;