mac:use a std::string

This commit is contained in:
Richard Barber
2020-02-17 11:24:05 -08:00
parent 18c360ed4d
commit 38037aee8c

View File

@@ -2272,15 +2272,15 @@ void Options::load(bool lightweight)
#ifdef __APPLE__ #ifdef __APPLE__
// Build Application Support directory path for macOS. // Build Application Support directory path for macOS.
const gchar* homedir = g_getenv("HOME"); // This returns the current container data dir in ~/Library const char* homedir = g_getenv("HOME"); // This returns the current container data dir in ~/Library
const gchar* configdir = "/Application Support/RawTherapee/config"; std::string configdir = "/Application Support/RawTherapee/config";
gchar* homebuf = g_strnfill(789, 'a'); std::string homebuf{homedir};
gsize homelength = strlen(homedir); int homelength = strlen(homebuf.c_str());
g_stpcpy(homebuf, homedir);
homebuf[homelength-45] = '\0'; homebuf[homelength-45] = '\0';
configdir = "/Application Support/RawTherapee/config"; // Back out of containers and into App. Support configdir = "/Application Support/RawTherapee/config";
const gchar* pathconcat = g_strconcat(homebuf, configdir); std::string configpath = homebuf + configdir;
path = pathconcat; path = configpath.c_str();
std::cout<<path<<std::endl;
#else #else
path = g_getenv("RT_SETTINGS"); path = g_getenv("RT_SETTINGS");
#endif #endif
@@ -2328,10 +2328,11 @@ 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. // 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* cachedir; const char* cachedir;
cachedir = "/Application Support/RawTherapee/cache"; // Back out of containers and into App. Support cachedir = "/Application Support/RawTherapee/cache"; // Back out of containers and into App. Support
const gchar* pathconcat2 = g_strconcat(homebuf, cachedir); std::string cachepath = homebuf + cachedir;
path = pathconcat2; path = cachepath.c_str();
std::cout<<path<<std::endl;
#else #else
path = g_getenv("RT_CACHE"); path = g_getenv("RT_CACHE");
#endif #endif