1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-25 18:41:33 +00:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Nikolay Kasyanov 2012-02-24 20:28:23 +04:00
commit 77368e6f05
8 changed files with 28 additions and 11 deletions

View file

@ -6,6 +6,7 @@
#include <algorithm> #include <algorithm>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/algorithm/string/erase.hpp>
/** /**
* \namespace Files * \namespace Files
@ -69,9 +70,11 @@ void ConfigurationManager::readConfiguration(boost::program_options::variables_m
void ConfigurationManager::processPaths(Files::PathContainer& dataDirs) void ConfigurationManager::processPaths(Files::PathContainer& dataDirs)
{ {
std::string path;
for (Files::PathContainer::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) 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 // Check if path contains a token
if (!path.empty() && *path.begin() == '?') if (!path.empty() && *path.begin() == '?')

View file

@ -1,7 +1,11 @@
#ifndef COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP #ifndef COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP
#define COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP #define COMPONENTS_FILES_CONFIGURATIONMANAGER_HPP
#ifdef _WIN32
#include <boost/tr1/tr1/unordered_map>
#else
#include <tr1/unordered_map> #include <tr1/unordered_map>
#endif
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>

View file

@ -30,7 +30,7 @@
#include <components/files/linuxpath.hpp> #include <components/files/linuxpath.hpp>
namespace Files { typedef LinuxPath TargetPathType; } namespace Files { typedef LinuxPath TargetPathType; }
#elif defined(__WIN32) || defined(__WINDOWS__) #elif defined(__WIN32) || defined(__WINDOWS__) || defined(_WIN32)
#include <components/files/windowspath.hpp> #include <components/files/windowspath.hpp>
namespace Files { typedef WindowsPath TargetPathType; } namespace Files { typedef WindowsPath TargetPathType; }

View file

@ -105,11 +105,16 @@ boost::filesystem::path LinuxPath::getInstallPath() const
std::string line; std::string line;
std::string mwpath; std::string mwpath;
while (std::getline(file, line) && !line.empty()) while (std::getline(file, line))
{ {
if (line[0] == '[') // we found an entry 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) else if (isRegEntry)
{ {

View file

@ -46,7 +46,7 @@ struct LinuxPath
boost::filesystem::path getUserPath() const; 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 * \return boost::filesystem::path
*/ */

View file

@ -105,11 +105,16 @@ boost::filesystem::path MacOsPath::getInstallPath() const
std::string line; std::string line;
std::string mwpath; std::string mwpath;
while (std::getline(file, line) && !line.empty()) while (std::getline(file, line))
{ {
if (line[0] == '[') // we found an entry 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) else if (isRegEntry)
{ {

View file

@ -39,21 +39,21 @@ namespace Files
struct MacOsPath struct MacOsPath
{ {
/** /**
* \brief Return path to the local configuration directory. * \brief Return path to the local directory.
* *
* \return boost::filesystem::path * \return boost::filesystem::path
*/ */
boost::filesystem::path getUserPath() const; 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 * \return boost::filesystem::path
*/ */
boost::filesystem::path getGlobalPath() const; 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. * place where an application was started.
* *
* \return boost::filesystem::path * \return boost::filesystem::path

View file

@ -62,7 +62,7 @@ struct WindowsPath
boost::filesystem::path getLocalPath() const; boost::filesystem::path getLocalPath() const;
/** /**
* \brief Return same path like getGlobalConfigPath * \brief Return same path like getGlobalPath
* *
* \return boost::filesystem::path * \return boost::filesystem::path
*/ */