mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Convert paths to generic form after 341aa766d8
Might not have caught all places where this should be done.
This commit is contained in:
parent
341aa766d8
commit
3c189b33c1
|
@ -159,7 +159,7 @@ void SystemData::populateFolder(FolderData* folder)
|
||||||
//add directories that also do not match an extension as folders
|
//add directories that also do not match an extension as folders
|
||||||
if(!isGame && fs::is_directory(filePath))
|
if(!isGame && fs::is_directory(filePath))
|
||||||
{
|
{
|
||||||
FolderData* newFolder = new FolderData(this, filePath.string(), filePath.stem().string());
|
FolderData* newFolder = new FolderData(this, filePath.generic_string(), filePath.stem().string());
|
||||||
populateFolder(newFolder);
|
populateFolder(newFolder);
|
||||||
|
|
||||||
//ignore folders that do not contain games
|
//ignore folders that do not contain games
|
||||||
|
@ -233,7 +233,11 @@ void SystemData::loadConfig()
|
||||||
sysPath = varValue.substr(0, varValue.length() - 1);
|
sysPath = varValue.substr(0, varValue.length() - 1);
|
||||||
else
|
else
|
||||||
sysPath = varValue;
|
sysPath = varValue;
|
||||||
}else if(varName == "EXTENSION")
|
//convert path to generic directory seperators
|
||||||
|
boost::filesystem::path genericPath(sysPath);
|
||||||
|
sysPath = genericPath.generic_string();
|
||||||
|
}
|
||||||
|
else if(varName == "EXTENSION")
|
||||||
sysExtension = varValue;
|
sysExtension = varValue;
|
||||||
else if(varName == "COMMAND")
|
else if(varName == "COMMAND")
|
||||||
sysCommand = varValue;
|
sysCommand = varValue;
|
||||||
|
|
|
@ -133,7 +133,9 @@ void parseGamelist(SystemData* system)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string path = pathNode.text().get();
|
//convert path to generic directory seperators
|
||||||
|
boost::filesystem::path gamePath(pathNode.text().get());
|
||||||
|
std::string path = gamePath.generic_string();
|
||||||
|
|
||||||
//expand "."
|
//expand "."
|
||||||
if(path[0] == '.')
|
if(path[0] == '.')
|
||||||
|
@ -169,7 +171,7 @@ void parseGamelist(SystemData* system)
|
||||||
{
|
{
|
||||||
newImage.erase(0, 1);
|
newImage.erase(0, 1);
|
||||||
boost::filesystem::path pathname(xmlpath);
|
boost::filesystem::path pathname(xmlpath);
|
||||||
newImage.insert(0, pathname.parent_path().string() );
|
newImage.insert(0, pathname.parent_path().generic_string() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//if the image exist, set it
|
//if the image exist, set it
|
||||||
|
@ -218,7 +220,9 @@ void addGameDataNode(pugi::xml_node & parent, const GameData * game)
|
||||||
//add values
|
//add values
|
||||||
if (!game->getPath().empty()) {
|
if (!game->getPath().empty()) {
|
||||||
pugi::xml_node pathNode = newGame.append_child(GameData::xmlTagPath.c_str());
|
pugi::xml_node pathNode = newGame.append_child(GameData::xmlTagPath.c_str());
|
||||||
pathNode.text().set(game->getPath().c_str());
|
//store path with generic directory seperators
|
||||||
|
boost::filesystem::path gamePath(game->getPath());
|
||||||
|
pathNode.text().set(gamePath.generic_string().c_str());
|
||||||
}
|
}
|
||||||
if (!game->getName().empty()) {
|
if (!game->getName().empty()) {
|
||||||
pugi::xml_node nameNode = newGame.append_child(GameData::xmlTagName.c_str());
|
pugi::xml_node nameNode = newGame.append_child(GameData::xmlTagName.c_str());
|
||||||
|
@ -294,8 +298,10 @@ void updateGamelist(SystemData* system)
|
||||||
LOG(LogError) << "<" << GameData::xmlTagGame << "> node contains no <" << GameData::xmlTagPath << "> child!";
|
LOG(LogError) << "<" << GameData::xmlTagGame << "> node contains no <" << GameData::xmlTagPath << "> child!";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//check path
|
//check paths. use the same directory separators
|
||||||
if (pathNode.text().get() == game->getPath()) {
|
boost::filesystem::path nodePath(pathNode.text().get());
|
||||||
|
boost::filesystem::path gamePath(game->getPath());
|
||||||
|
if (nodePath.generic_string() == gamePath.generic_string()) {
|
||||||
//found the game. remove it. it will be added again later with updated values
|
//found the game. remove it. it will be added again later with updated values
|
||||||
root.remove_child(gameNode);
|
root.remove_child(gameNode);
|
||||||
//break node search loop
|
//break node search loop
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
|
|
||||||
std::string getHomePath()
|
std::string getHomePath()
|
||||||
|
@ -31,5 +32,7 @@ std::string getHomePath()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return homePath;
|
//convert path to generic directory seperators
|
||||||
|
boost::filesystem::path genericPath(homePath);
|
||||||
|
return genericPath.generic_string();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue