mac:use another variable name for cache folder

This commit is contained in:
Richard Barber 2020-02-16 23:03:48 -08:00
parent 0770363c6f
commit af624df798

View File

@ -2271,9 +2271,10 @@ void Options::load(bool lightweight)
Glib::ustring dPath; Glib::ustring dPath;
#ifdef __APPLE__ #ifdef __APPLE__
// Build Application Support directory path for macOS.
const gchar* homedir; const gchar* homedir;
const gchar* configdir; const gchar* configdir;
homedir = g_getenv("HOME"); homedir = g_getenv("HOME"); // This returns the current container
std::cout << "homedir=" << homedir << "\n"; std::cout << "homedir=" << homedir << "\n";
configdir = "/../../../Application Support/RawTherapee/config"; configdir = "/../../../Application Support/RawTherapee/config";
int bufferSize = strlen(homedir) + strlen(configdir) + 1; int bufferSize = strlen(homedir) + strlen(configdir) + 1;
@ -2327,20 +2328,17 @@ void Options::load(bool lightweight)
rtdir = Glib::build_filename(argv0, "mysettings"); rtdir = Glib::build_filename(argv0, "mysettings");
} }
// Modify the path of the cache folder to the one provided in RT_CACHE environment variable // 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__ #ifdef __APPLE__
const gchar* homedir;
const gchar* cachedir; const gchar* cachedir;
homedir = g_getenv("HOME"); // This returns the current container cachedir = "/../../../Application Support/RawTherapee/cache";
std::cout << "homedir=" << homedir << "\n"; int bufferSize2 = strlen(homedir) + strlen(cachedir) + 1; //reuse homedir from above.
configdir = "/../../../Application Support/RawTherapee/cache"; gchar* concatString2 = new gchar[ bufferSize2 ];
int bufferSize = strlen(homedir) + strlen(cachedir) + 1; strcpy( concatString2, homedir );
gchar* concatString = new gchar[ bufferSize ]; strcat( concatString2, cachedir );
strcpy( concatString, homedir );
strcat( concatString, cachedir );
std::cout << path << "\n"; std::cout << path << "\n";
path = concatString; path = concatString2;
delete[] concatString; delete[] concatString2;
#else #else
path = g_getenv("RT_CACHE"); path = g_getenv("RT_CACHE");
#endif #endif