Convert paths to generic form after 341aa766d8

Might not have caught all places where this should be done.
This commit is contained in:
Bim Overbohm 2013-07-03 14:27:06 +02:00
parent 341aa766d8
commit 3c189b33c1
3 changed files with 21 additions and 8 deletions

View file

@ -159,7 +159,7 @@ void SystemData::populateFolder(FolderData* folder)
//add directories that also do not match an extension as folders
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);
//ignore folders that do not contain games
@ -233,7 +233,11 @@ void SystemData::loadConfig()
sysPath = varValue.substr(0, varValue.length() - 1);
else
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;
else if(varName == "COMMAND")
sysCommand = varValue;

View file

@ -133,7 +133,9 @@ void parseGamelist(SystemData* system)
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 "."
if(path[0] == '.')
@ -169,7 +171,7 @@ void parseGamelist(SystemData* system)
{
newImage.erase(0, 1);
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
@ -218,7 +220,9 @@ void addGameDataNode(pugi::xml_node & parent, const GameData * game)
//add values
if (!game->getPath().empty()) {
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()) {
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!";
continue;
}
//check path
if (pathNode.text().get() == game->getPath()) {
//check paths. use the same directory separators
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
root.remove_child(gameNode);
//break node search loop

View file

@ -1,5 +1,6 @@
#include "platform.h"
#include <stdlib.h>
#include <boost/filesystem.hpp>
std::string getHomePath()
@ -31,5 +32,7 @@ std::string getHomePath()
}
#endif
return homePath;
//convert path to generic directory seperators
boost::filesystem::path genericPath(homePath);
return genericPath.generic_string();
}