2011-08-19 19:06:09 +00:00
|
|
|
#include "windowspath.hpp"
|
|
|
|
|
|
|
|
#if defined(_WIN32) || defined(__WINDOWS__)
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <shobj.h>
|
|
|
|
|
|
|
|
namespace Files
|
|
|
|
{
|
|
|
|
|
2012-01-21 00:14:35 +00:00
|
|
|
boost::filesystem::path WindowsPath::getUserPath() const
|
2011-08-19 19:06:09 +00:00
|
|
|
{
|
2012-01-21 00:14:35 +00:00
|
|
|
boost::filesystem::path userPath(".");
|
2011-08-19 19:06:09 +00:00
|
|
|
boost::filesystem::path suffix("/");
|
|
|
|
|
|
|
|
TCHAR path[MAX_PATH];
|
|
|
|
memset(path, 0, sizeof(path));
|
|
|
|
|
|
|
|
if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, path)))
|
|
|
|
{
|
|
|
|
PathAppend(path, TEXT("My Games"));
|
2012-01-21 00:14:35 +00:00
|
|
|
userPath = boost::filesystem::path(path);
|
2011-08-19 19:06:09 +00:00
|
|
|
}
|
|
|
|
|
2012-01-21 00:14:35 +00:00
|
|
|
userPath /= suffix;
|
2011-08-19 19:06:09 +00:00
|
|
|
|
2012-01-21 00:14:35 +00:00
|
|
|
return userPath;
|
2011-08-19 19:06:09 +00:00
|
|
|
}
|
|
|
|
|
2012-01-21 00:14:35 +00:00
|
|
|
boost::filesystem::path WindowsPath::getGlobalPath() const
|
2011-08-19 19:06:09 +00:00
|
|
|
{
|
2012-01-21 00:14:35 +00:00
|
|
|
boost::filesystem::path globalPath(".");
|
2011-08-19 19:06:09 +00:00
|
|
|
boost::filesystem::path suffix("/");
|
|
|
|
|
|
|
|
TCHAR path[MAX_PATH];
|
|
|
|
memset(path, 0, sizeof(path));
|
|
|
|
|
|
|
|
if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES | CSIDL_FLAG_CREATE, NULL, 0, path)))
|
|
|
|
{
|
2012-01-21 00:14:35 +00:00
|
|
|
globalPath = boost::filesystem::path(path);
|
2011-08-19 19:06:09 +00:00
|
|
|
}
|
|
|
|
|
2012-01-21 00:14:35 +00:00
|
|
|
globalPath /= suffix;
|
2011-08-19 19:06:09 +00:00
|
|
|
|
2012-01-21 00:14:35 +00:00
|
|
|
return globalPath;
|
2011-08-19 19:06:09 +00:00
|
|
|
}
|
|
|
|
|
2012-01-21 00:14:35 +00:00
|
|
|
boost::filesystem::path WindowsPath::getLocalPath() const
|
2011-08-19 19:06:09 +00:00
|
|
|
{
|
|
|
|
return boost::filesystem::path("./");
|
|
|
|
}
|
|
|
|
|
2012-01-21 16:58:49 +00:00
|
|
|
/**
|
|
|
|
* FIXME: Someone with Windows system should check this and correct if necessary
|
|
|
|
*/
|
|
|
|
boost::filesystem::path WindowsPath::getUserDataPath() const
|
|
|
|
{
|
|
|
|
return getUserConfigPath();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* FIXME: Someone with Windows system should check this and correct if necessary
|
|
|
|
*/
|
|
|
|
boost::filesystem::path WindowsPath::getGlobalDataPath() const
|
|
|
|
{
|
|
|
|
return getGlobalConfigPath();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* FIXME: Someone with Windows system should check this and correct if necessary
|
|
|
|
*/
|
|
|
|
boost::filesystem::path WindowsPath::getLocalDataPath() const
|
|
|
|
{
|
|
|
|
return boost::filesystem::path("./data/");
|
|
|
|
}
|
|
|
|
|
|
|
|
boost::filesystem::path WindowsPath::getInstallPath() const;
|
|
|
|
{
|
|
|
|
return boost::filesystem::path("./");
|
|
|
|
}
|
|
|
|
|
2011-08-19 19:06:09 +00:00
|
|
|
} /* namespace Files */
|
|
|
|
|
|
|
|
#endif /* defined(_WIN32) || defined(__WINDOWS__) */
|