Skip to content
Snippets Groups Projects
Commit d5902b64 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#14569: Add android's config path

parent f290d1ee
No related branches found
No related tags found
No related merge requests found
...@@ -76,17 +76,32 @@ const char *get_data_dir() ...@@ -76,17 +76,32 @@ const char *get_data_dir()
return path.c_str(); return path.c_str();
} }
bool create_pidfile() std::string get_path_for_cache(void) {
{
std::string xdg_env(XDG_CACHE_HOME); std::string xdg_env(XDG_CACHE_HOME);
std::string path = (not xdg_env.empty()) ? xdg_env : std::string(HOMEDIR) + DIR_SEPARATOR_STR ".cache/"; std::string path = (not xdg_env.empty()) ? xdg_env : std::string(HOMEDIR) + DIR_SEPARATOR_STR ".cache/";
return path;
}
std::string get_path_for_cache_android(void) {
std::string path = "/data/.cache/";
return path;
}
bool create_pidfile()
{
#if ANDROID
std::string path = get_path_for_cache_android();
#else
std::string path = get_path_for_cache();
#endif
if (!check_dir(path.c_str())) if (not check_dir(path.c_str()))
return false; return false;
path += "sflphone"; path += "sflphone";
if (!check_dir(path.c_str())) if (not check_dir(path.c_str()))
return false; return false;
std::string pidfile = path + "/" PIDFILE; std::string pidfile = path + "/" PIDFILE;
......
...@@ -100,7 +100,7 @@ ManagerImpl::ManagerImpl() : ...@@ -100,7 +100,7 @@ ManagerImpl::ManagerImpl() :
void ManagerImpl::init(const std::string &config_file) void ManagerImpl::init(const std::string &config_file)
{ {
path_ = config_file.empty() ? createConfigFile() : config_file; path_ = config_file.empty() ? retrieveConfigPath() : config_file;
DEBUG("Configuration file path: %s", path_.c_str()); DEBUG("Configuration file path: %s", path_.c_str());
try { try {
...@@ -1780,10 +1780,14 @@ ManagerImpl::getTelephoneFile() ...@@ -1780,10 +1780,14 @@ ManagerImpl::getTelephoneFile()
/** /**
* Initialization: Main Thread * Initialization: Main Thread
*/ */
std::string ManagerImpl::createConfigFile() const std::string ManagerImpl::retrieveConfigPath() const
{ {
#if ANDROID
std::string configdir = "/data/data";
#else
std::string configdir = std::string(HOMEDIR) + DIR_SEPARATOR_STR + std::string configdir = std::string(HOMEDIR) + DIR_SEPARATOR_STR +
".config" + DIR_SEPARATOR_STR + PACKAGE; ".config" + DIR_SEPARATOR_STR + PACKAGE;
#endif
std::string xdg_env(XDG_CONFIG_HOME); std::string xdg_env(XDG_CONFIG_HOME);
if (not xdg_env.empty()) { if (not xdg_env.empty()) {
......
...@@ -883,7 +883,7 @@ class ManagerImpl { ...@@ -883,7 +883,7 @@ class ManagerImpl {
/** /**
* Create config directory in home user and return configuration file path * Create config directory in home user and return configuration file path
*/ */
std::string createConfigFile() const; std::string retrieveConfigPath() const;
/* /*
* Initialize zeroconf module and scanning * Initialize zeroconf module and scanning
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment