mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:00 +01:00
portable windows data directory
This commit is contained in:
parent
442a0c48e7
commit
cb324ca723
10
FS.cpp
10
FS.cpp
|
@ -46,8 +46,18 @@ namespace fs {
|
||||||
}
|
}
|
||||||
#if defined(WIN32) || defined(_WIN32)
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
char localAppData[MAX_PATH];
|
char localAppData[MAX_PATH];
|
||||||
|
// check executable directory first
|
||||||
|
GetModuleFileName (NULL, localAppData, MAX_PATH);
|
||||||
|
auto execPath = boost::filesystem::path(localAppData).parent_path();
|
||||||
|
// if config file exists in .exe's folder use it
|
||||||
|
if(boost::filesystem::exists(execPath/"i2pd.conf")) // TODO: magic string
|
||||||
|
dataDir = execPath.string ();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// otherwise %appdata%
|
||||||
SHGetFolderPath(NULL, CSIDL_APPDATA, 0, NULL, localAppData);
|
SHGetFolderPath(NULL, CSIDL_APPDATA, 0, NULL, localAppData);
|
||||||
dataDir = std::string(localAppData) + "\\" + appName;
|
dataDir = std::string(localAppData) + "\\" + appName;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
#elif defined(MAC_OSX)
|
#elif defined(MAC_OSX)
|
||||||
char *home = getenv("HOME");
|
char *home = getenv("HOME");
|
||||||
|
|
Loading…
Reference in a new issue