mac: use fewer variables

This commit is contained in:
Richard Barber
2020-02-17 11:31:39 -08:00
parent 38037aee8c
commit e4f16c2005

View File

@@ -2273,12 +2273,10 @@ void Options::load(bool lightweight)
#ifdef __APPLE__
// Build Application Support directory path for macOS.
const char* homedir = g_getenv("HOME"); // This returns the current container data dir in ~/Library
std::string configdir = "/Application Support/RawTherapee/config";
std::string homebuf{homedir};
int homelength = strlen(homebuf.c_str());
homebuf[homelength-45] = '\0';
configdir = "/Application Support/RawTherapee/config";
std::string configpath = homebuf + configdir;
homebuf[homelength-44] = '\0';
std::string configpath = homebuf + "/Application Support/RawTherapee/config";
path = configpath.c_str();
std::cout<<path<<std::endl;
#else
@@ -2328,9 +2326,7 @@ void Options::load(bool lightweight)
// Modify the path of the cache folder to the one provided in RT_CACHE environment variable. Build the cache folder name in macOS.
#ifdef __APPLE__
const char* cachedir;
cachedir = "/Application Support/RawTherapee/cache"; // Back out of containers and into App. Support
std::string cachepath = homebuf + cachedir;
std::string cachepath = homebuf + "/Application Support/RawTherapee/cache";
path = cachepath.c_str();
std::cout<<path<<std::endl;
#else