mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Merge pull request #413 from jrassa/windows-fixes
fix for several small issues in Windows build
This commit is contained in:
commit
b622a4272e
|
@ -973,8 +973,7 @@ std::vector<std::string> CollectionSystemManager::getCollectionsFromConfigFolder
|
||||||
if (Utils::FileSystem::isRegularFile(*it))
|
if (Utils::FileSystem::isRegularFile(*it))
|
||||||
{
|
{
|
||||||
// it's a file
|
// it's a file
|
||||||
std::string file = *it;
|
std::string filename = Utils::FileSystem::getFileName(*it);
|
||||||
std::string filename = file.substr(configPath.size());
|
|
||||||
|
|
||||||
// need to confirm filename matches config format
|
// need to confirm filename matches config format
|
||||||
if (filename != "custom-.cfg" && Utils::String::startsWith(filename, "custom-") && Utils::String::endsWith(filename, ".cfg"))
|
if (filename != "custom-.cfg" && Utils::String::startsWith(filename, "custom-") && Utils::String::endsWith(filename, ".cfg"))
|
||||||
|
@ -1041,7 +1040,7 @@ std::string getCustomCollectionConfigPath(std::string collectionName)
|
||||||
|
|
||||||
std::string getCollectionsFolder()
|
std::string getCollectionsFolder()
|
||||||
{
|
{
|
||||||
return Utils::FileSystem::getHomePath() + "/.emulationstation/collections/";
|
return Utils::FileSystem::getGenericPath(Utils::FileSystem::getHomePath() + "/.emulationstation/collections/");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool systemSort(SystemData* sys1, SystemData* sys2)
|
bool systemSort(SystemData* sys1, SystemData* sys2)
|
||||||
|
@ -1049,4 +1048,4 @@ bool systemSort(SystemData* sys1, SystemData* sys2)
|
||||||
std::string name1 = Utils::String::toUpper(sys1->getName());
|
std::string name1 = Utils::String::toUpper(sys1->getName());
|
||||||
std::string name2 = Utils::String::toUpper(sys2->getName());
|
std::string name2 = Utils::String::toUpper(sys2->getName());
|
||||||
return name1.compare(name2) < 0;
|
return name1.compare(name2) < 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ void FileData::launchGame(Window* window)
|
||||||
|
|
||||||
const std::string rom = Utils::FileSystem::getEscapedPath(getPath());
|
const std::string rom = Utils::FileSystem::getEscapedPath(getPath());
|
||||||
const std::string basename = Utils::FileSystem::getStem(getPath());
|
const std::string basename = Utils::FileSystem::getStem(getPath());
|
||||||
const std::string rom_raw = getPath();
|
const std::string rom_raw = Utils::FileSystem::getPreferredPath(getPath());
|
||||||
|
|
||||||
command = Utils::String::replace(command, "%ROM%", rom);
|
command = Utils::String::replace(command, "%ROM%", rom);
|
||||||
command = Utils::String::replace(command, "%BASENAME%", basename);
|
command = Utils::String::replace(command, "%BASENAME%", basename);
|
||||||
|
|
|
@ -197,6 +197,18 @@ namespace Utils
|
||||||
|
|
||||||
} // getExePath
|
} // getExePath
|
||||||
|
|
||||||
|
std::string getPreferredPath(const std::string& _path)
|
||||||
|
{
|
||||||
|
std::string path = _path;
|
||||||
|
size_t offset = std::string::npos;
|
||||||
|
#if defined(_WIN32)
|
||||||
|
// convert '/' to '\\'
|
||||||
|
while((offset = path.find('/')) != std::string::npos)
|
||||||
|
path.replace(offset, 1, "\\");
|
||||||
|
#endif // _WIN32
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
std::string getGenericPath(const std::string& _path)
|
std::string getGenericPath(const std::string& _path)
|
||||||
{
|
{
|
||||||
std::string path = _path;
|
std::string path = _path;
|
||||||
|
@ -225,7 +237,7 @@ namespace Utils
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// windows escapes stuff by just putting everything in quotes
|
// windows escapes stuff by just putting everything in quotes
|
||||||
return '"' + path + '"';
|
return '"' + getPreferredPath(path) + '"';
|
||||||
#else // _WIN32
|
#else // _WIN32
|
||||||
// insert a backslash before most characters that would mess up a bash path
|
// insert a backslash before most characters that would mess up a bash path
|
||||||
const char* invalidChars = "\\ '\"!$^&*(){}[]?;<>";
|
const char* invalidChars = "\\ '\"!$^&*(){}[]?;<>";
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace Utils
|
||||||
std::string getHomePath ();
|
std::string getHomePath ();
|
||||||
std::string getCWDPath ();
|
std::string getCWDPath ();
|
||||||
std::string getExePath ();
|
std::string getExePath ();
|
||||||
|
std::string getPreferredPath (const std::string& _path);
|
||||||
std::string getGenericPath (const std::string& _path);
|
std::string getGenericPath (const std::string& _path);
|
||||||
std::string getEscapedPath (const std::string& _path);
|
std::string getEscapedPath (const std::string& _path);
|
||||||
std::string getCanonicalPath (const std::string& _path);
|
std::string getCanonicalPath (const std::string& _path);
|
||||||
|
|
Loading…
Reference in a new issue