diff --git a/components/files/configurationmanager.cpp b/components/files/configurationmanager.cpp index 5cf2952c74..887a054ade 100644 --- a/components/files/configurationmanager.cpp +++ b/components/files/configurationmanager.cpp @@ -6,6 +6,7 @@ #include #include +#include /** * \namespace Files @@ -69,9 +70,11 @@ void ConfigurationManager::readConfiguration(boost::program_options::variables_m void ConfigurationManager::processPaths(Files::PathContainer& dataDirs) { + std::string path; for (Files::PathContainer::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) { - const std::string& path = it->string(); + path = it->string(); + boost::erase_all(path, "\""); // Check if path contains a token if (!path.empty() && *path.begin() == '?') diff --git a/components/files/configurationmanager.hpp b/components/files/configurationmanager.hpp index 7d77df9c00..7fb3793c64 100644 --- a/components/files/configurationmanager.hpp +++ b/components/files/configurationmanager.hpp @@ -1,7 +1,11 @@ #ifndef COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP #define COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP +#ifdef _WIN32 +#include +#else #include +#endif #include #include diff --git a/components/files/fixedpath.hpp b/components/files/fixedpath.hpp index 4e054b17ff..9e5c4f8f26 100644 --- a/components/files/fixedpath.hpp +++ b/components/files/fixedpath.hpp @@ -30,7 +30,7 @@ #include namespace Files { typedef LinuxPath TargetPathType; } -#elif defined(__WIN32) || defined(__WINDOWS__) +#elif defined(__WIN32) || defined(__WINDOWS__) || defined(_WIN32) #include namespace Files { typedef WindowsPath TargetPathType; } diff --git a/components/files/linuxpath.cpp b/components/files/linuxpath.cpp index 0b315ccfb2..92e4dce33f 100644 --- a/components/files/linuxpath.cpp +++ b/components/files/linuxpath.cpp @@ -105,11 +105,16 @@ boost::filesystem::path LinuxPath::getInstallPath() const std::string line; std::string mwpath; - while (std::getline(file, line) && !line.empty()) + while (std::getline(file, line)) { if (line[0] == '[') // we found an entry { - isRegEntry = (line.find("Softworks\\Morrowind]") != std::string::npos); + if (isRegEntry) + { + break; + } + + isRegEntry = (line.find("Softworks\\\\Morrowind]") != std::string::npos); } else if (isRegEntry) { diff --git a/components/files/linuxpath.hpp b/components/files/linuxpath.hpp index 873f8801de..48fdbb2ff6 100644 --- a/components/files/linuxpath.hpp +++ b/components/files/linuxpath.hpp @@ -46,7 +46,7 @@ struct LinuxPath boost::filesystem::path getUserPath() const; /** - * \brief Return path to the global (system) configuration directory. + * \brief Return path to the global (system) directory where game files could be placed. * * \return boost::filesystem::path */ diff --git a/components/files/macospath.cpp b/components/files/macospath.cpp index 6225fc01f4..fc36e2a9cd 100644 --- a/components/files/macospath.cpp +++ b/components/files/macospath.cpp @@ -105,11 +105,16 @@ boost::filesystem::path MacOsPath::getInstallPath() const std::string line; std::string mwpath; - while (std::getline(file, line) && !line.empty()) + while (std::getline(file, line)) { if (line[0] == '[') // we found an entry { - isRegEntry = (line.find("Softworks\\Morrowind]") != std::string::npos); + if (isRegEntry) + { + break; + } + + isRegEntry = (line.find("Softworks\\\\Morrowind]") != std::string::npos); } else if (isRegEntry) { diff --git a/components/files/macospath.hpp b/components/files/macospath.hpp index 7656538c19..0e9b3402e6 100644 --- a/components/files/macospath.hpp +++ b/components/files/macospath.hpp @@ -39,21 +39,21 @@ namespace Files struct MacOsPath { /** - * \brief Return path to the local configuration directory. + * \brief Return path to the local directory. * * \return boost::filesystem::path */ boost::filesystem::path getUserPath() const; /** - * \brief Return path to the global (system) configuration directory. + * \brief Return path to the global (system) directory. * * \return boost::filesystem::path */ boost::filesystem::path getGlobalPath() const; /** - * \brief Return path to the runtime configuration directory which is the + * \brief Return path to the runtime directory which is the * place where an application was started. * * \return boost::filesystem::path diff --git a/components/files/windowspath.hpp b/components/files/windowspath.hpp index 919d087f11..d4c716c502 100644 --- a/components/files/windowspath.hpp +++ b/components/files/windowspath.hpp @@ -62,7 +62,7 @@ struct WindowsPath boost::filesystem::path getLocalPath() const; /** - * \brief Return same path like getGlobalConfigPath + * \brief Return same path like getGlobalPath * * \return boost::filesystem::path */