|
|
|
@ -45,18 +45,18 @@ namespace fs {
@@ -45,18 +45,18 @@ namespace fs {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
#if defined(WIN32) || defined(_WIN32) |
|
|
|
|
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); |
|
|
|
|
dataDir = std::string(localAppData) + "\\" + appName; |
|
|
|
|
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); |
|
|
|
|
dataDir = std::string(localAppData) + "\\" + appName; |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
#elif defined(MAC_OSX) |
|
|
|
@ -66,9 +66,11 @@ namespace fs {
@@ -66,9 +66,11 @@ namespace fs {
|
|
|
|
|
return; |
|
|
|
|
#else /* other unix */ |
|
|
|
|
#if defined(ANDROID) |
|
|
|
|
if (boost::filesystem::exists("/sdcard")) |
|
|
|
|
const char * ext = getenv("EXTERNAL_STORAGE"); |
|
|
|
|
if (!ext) ext = "/sdcard"; |
|
|
|
|
if (boost::filesystem::exists(ext)) |
|
|
|
|
{ |
|
|
|
|
dataDir = "/sdcard/" + appName; |
|
|
|
|
dataDir = ext + appName; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// otherwise use /data/files
|
|
|
|
|