2011-08-19 21:06:09 +02:00
|
|
|
#include "windowspath.hpp"
|
|
|
|
|
|
|
|
#if defined(_WIN32) || defined(__WINDOWS__)
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <shobj.h>
|
|
|
|
|
|
|
|
namespace Files
|
|
|
|
{
|
|
|
|
|
2012-01-21 01:14:35 +01:00
|
|
|
boost::filesystem::path WindowsPath::getUserPath() const
|
2011-08-19 21:06:09 +02:00
|
|
|
{
|
2012-01-21 01:14:35 +01:00
|
|
|
boost::filesystem::path userPath(".");
|
2011-08-19 21:06:09 +02: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 01:14:35 +01:00
|
|
|
userPath = boost::filesystem::path(path);
|
2011-08-19 21:06:09 +02:00
|
|
|
}
|
|
|
|
|
2012-01-21 01:14:35 +01:00
|
|
|
userPath /= suffix;
|
2011-08-19 21:06:09 +02:00
|
|
|
|
2012-01-21 01:14:35 +01:00
|
|
|
return userPath;
|
2011-08-19 21:06:09 +02:00
|
|
|
}
|
|
|
|
|
2012-01-21 01:14:35 +01:00
|
|
|
boost::filesystem::path WindowsPath::getGlobalPath() const
|
2011-08-19 21:06:09 +02:00
|
|
|
{
|
2012-01-21 01:14:35 +01:00
|
|
|
boost::filesystem::path globalPath(".");
|
2011-08-19 21:06:09 +02: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 01:14:35 +01:00
|
|
|
globalPath = boost::filesystem::path(path);
|
2011-08-19 21:06:09 +02:00
|
|
|
}
|
|
|
|
|
2012-01-21 01:14:35 +01:00
|
|
|
globalPath /= suffix;
|
2011-08-19 21:06:09 +02:00
|
|
|
|
2012-01-21 01:14:35 +01:00
|
|
|
return globalPath;
|
2011-08-19 21:06:09 +02:00
|
|
|
}
|
|
|
|
|
2012-01-21 01:14:35 +01:00
|
|
|
boost::filesystem::path WindowsPath::getLocalPath() const
|
2011-08-19 21:06:09 +02:00
|
|
|
{
|
|
|
|
return boost::filesystem::path("./");
|
|
|
|
}
|
|
|
|
|
|
|
|
} /* namespace Files */
|
|
|
|
|
|
|
|
#endif /* defined(_WIN32) || defined(__WINDOWS__) */
|