mirror of https://github.com/vitalif/grive2
parent
9a76cb8839
commit
cf2c827a6e
|
@ -27,30 +27,10 @@ namespace gr {
|
||||||
|
|
||||||
const std::string& Config::Filename()
|
const std::string& Config::Filename()
|
||||||
{
|
{
|
||||||
static std::string cfg_path;
|
static const char *env_cfg = ::getenv( "GR_CONFIG" ) ;
|
||||||
char *cfg_base;
|
static const std::string filename = (env_cfg != 0) ? env_cfg : ".grive" ;
|
||||||
bool fallback;
|
|
||||||
|
|
||||||
fallback = false;
|
|
||||||
cfg_base = getenv("XDG_CONFIG_HOME");
|
|
||||||
if (!cfg_base)
|
|
||||||
{
|
|
||||||
fallback = true;
|
|
||||||
cfg_base = getenv("HOME");
|
|
||||||
/* Clutter the current directory if forced to */
|
|
||||||
if (!cfg_base)
|
|
||||||
cfg_base = (char *)".";
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg_path = cfg_base;
|
return filename ;
|
||||||
cfg_path += "/";
|
|
||||||
if (fallback) /* Hidden folder */
|
|
||||||
cfg_path += ".";
|
|
||||||
cfg_path += "grive";
|
|
||||||
cfg_path += "/";
|
|
||||||
cfg_path += "config.json";
|
|
||||||
|
|
||||||
return cfg_path ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::Config() :
|
Config::Config() :
|
||||||
|
|
Loading…
Reference in New Issue