fs::get_config_dir, fs::get_executable_dir

This commit is contained in:
Nekotekina 2015-12-16 22:50:45 +03:00
parent 56ba5a765b
commit 321e6d3a86
21 changed files with 249 additions and 178 deletions

View file

@ -40,29 +40,3 @@ void rImage::SaveFile(const std::string& name, rImageType type)
throw EXCEPTION("unsupported type");
}
}
std::string rPlatform::getConfigDir()
{
static std::string dir = ".";
if (dir == ".")
{
#ifdef _WIN32
dir = "";
//mkdir(dir.c_str());
#else
if (getenv("XDG_CONFIG_HOME") != NULL)
dir = getenv("XDG_CONFIG_HOME");
else if (getenv("HOME") != NULL)
dir = getenv("HOME") + std::string("/.config");
else // Just in case
dir = "./config";
dir = dir + "/rpcs3/";
if (mkdir(dir.c_str(), 0777) == -1)
{
printf("An error occured during the creation of the configuration directory. (%d)", errno);
}
#endif
}
return dir;
}