mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
get home directory from EXTERNAL_STORAGE for andorid
This commit is contained in:
parent
bef628212e
commit
a41f179785
30
FS.cpp
30
FS.cpp
@ -45,18 +45,18 @@ namespace fs {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined(WIN32) || defined(_WIN32)
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
char localAppData[MAX_PATH];
|
char localAppData[MAX_PATH];
|
||||||
// check executable directory first
|
// check executable directory first
|
||||||
GetModuleFileName (NULL, localAppData, MAX_PATH);
|
GetModuleFileName (NULL, localAppData, MAX_PATH);
|
||||||
auto execPath = boost::filesystem::path(localAppData).parent_path();
|
auto execPath = boost::filesystem::path(localAppData).parent_path();
|
||||||
// if config file exists in .exe's folder use it
|
// if config file exists in .exe's folder use it
|
||||||
if(boost::filesystem::exists(execPath/"i2pd.conf")) // TODO: magic string
|
if(boost::filesystem::exists(execPath/"i2pd.conf")) // TODO: magic string
|
||||||
dataDir = execPath.string ();
|
dataDir = execPath.string ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// otherwise %appdata%
|
// 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)
|
||||||
@ -66,9 +66,11 @@ namespace fs {
|
|||||||
return;
|
return;
|
||||||
#else /* other unix */
|
#else /* other unix */
|
||||||
#if defined(ANDROID)
|
#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;
|
return;
|
||||||
}
|
}
|
||||||
// otherwise use /data/files
|
// otherwise use /data/files
|
||||||
|
Loading…
Reference in New Issue
Block a user