diff --git a/rtgui/options.cc b/rtgui/options.cc index d447bc980..31b816a19 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -2272,20 +2272,18 @@ void Options::load(bool lightweight) #ifdef __APPLE__ // Build Application Support directory path for macOS. - const gchar* homedir; - const gchar* configdir; - homedir = g_getenv("HOME"); // This returns the current container data dir in ~/Library - configdir = "/../../../Application Support/RawTherapee/config"; // Back out of containers and into App. Support - int bufferSize = strlen(homedir) + strlen(configdir) + 1; - gchar* concatString = new gchar[ bufferSize ]; - strcpy( concatString, homedir ); - strcat( concatString, configdir ); - path = concatString; - delete[] concatString; + const gchar* homedir = g_getenv("HOME"); // This returns the current container data dir in ~/Library + const gchar* configdir = "/Application Support/RawTherapee/config"; + gchar* homebuf = g_strnfill(789, 'a'); + gsize homelength = strlen(homedir); + g_stpcpy(homebuf, homedir); + homebuf[homelength-45] = '\0'; + configdir = "/Application Support/RawTherapee/config"; // Back out of containers and into App. Support + const gchar* pathconcat = g_strconcat(homebuf, configdir); + path = pathconcat; #else path = g_getenv("RT_SETTINGS"); #endif - if (path != nullptr) { rtdir = Glib::ustring(path); @@ -2294,6 +2292,8 @@ void Options::load(bool lightweight) throw Error(msg); } } else { + + #ifdef WIN32 WCHAR pathW[MAX_PATH] = {0}; @@ -2329,25 +2329,22 @@ 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 gchar* cachedir; - cachedir = "/../../../Application Support/RawTherapee/cache"; // Back out of containers and into App. Support - int bufferSize2 = strlen(homedir) + strlen(cachedir) + 1; //reuse homedir from above. - gchar* concatString2 = new gchar[ bufferSize2 ]; - strcpy( concatString2, homedir ); - strcat( concatString2, cachedir ); - path = concatString2; - delete[] concatString2; + cachedir = "/Application Support/RawTherapee/cache"; // Back out of containers and into App. Support + const gchar* pathconcat2 = g_strconcat(homebuf, cachedir); + path = pathconcat2; #else path = g_getenv("RT_CACHE"); #endif - if (path != nullptr) { cacheBaseDir = Glib::ustring(path); - + if (!Glib::path_is_absolute(cacheBaseDir)) { Glib::ustring msg = Glib::ustring::compose("Cache base dir %1 is not absolute", cacheBaseDir); throw Error(msg); } } + + // No environment variable provided, so falling back to the multi user mode, if enabled else if (options.multiUser) { #ifdef WIN32 diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 81746ba4b..4a9d8d41c 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -217,16 +217,16 @@ msg "Build GTK3 databases:" sed -i "" -e "s|${PWD}/RawTherapee.app/Contents/|/Applications/RawTherapee.app/Contents/|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules" sed -i "" -e "s|/opt/local/|/Applications/RawTherapee.app/Contents/Frameworks/|" "${ETC}/gtk-3.0/gtk.immodules" +# Install names +ModifyInstallNames + # Mime directory msg "Copying shared files from ${GTK_PREFIX}:" ditto {"${LOCAL_PREFIX}/local","${RESOURCES}"}/share/mime -# Install names -ModifyInstallNames - msg "Installing required application bundle files:" PROJECT_SOURCE_DATA_DIR="${PROJECT_SOURCE_DIR}/tools/osx" -ditto "${PROJECT_SOURCE_DIR}/build/Resources" "${RESOURCES}" +ditto "${CMAKE_BUILD_TYPE}/Resources" "${RESOURCES}" ditto "${PROJECT_SOURCE_DIR}/rtdata/fonts" "${ETC}/fonts" # App bundle resources @@ -260,19 +260,19 @@ echo " install_name_tool -add_rpath /Applications/RawTherapee.app/Contents/Fra done # Sign the app -msg "Codesigning:" CODESIGNID="$(cmake .. -LA -N | grep "CODESIGNID" | cut -d "=" -f2)" -if ! test -z "$CODESIGNID" ; then +if ! test -z "${CODESIGNID}" ; then +msg "Codesigning:" install -m 0644 "${PROJECT_SOURCE_DATA_DIR}/rt.entitlements" "${CONTENTS}/rt.entitlements" plutil -convert binary1 "${CONTENTS}/rt.entitlements" -codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp --entitlements "${CONTENTS}/rt.entitlements" "${CONTENTS}/rt.entitlements" -codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp --entitlements "${CONTENTS}/rt.entitlements" "${EXECUTABLE}" -codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp --entitlements "${CONTENTS}/rt.entitlements" "${EXECUTABLE}-cli" +codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --timestamp --entitlements '${CONTENTS}/rt.entitlements' '${CONTENTS}/rt.entitlements' +codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --timestamp --entitlements '${CONTENTS}/rt.entitlements' '${EXECUTABLE}' +codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --timestamp --entitlements '${CONTENTS}/rt.entitlements' '${EXECUTABLE}-cli' for frameworklibs in ${CONTENTS}/Frameworks/* ; do -codesign -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --timestamp "${frameworklibs}" +codesign -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --timestamp '${frameworklibs}' done -codesign --deep --preserve-metadata=identifier,entitlements,runtime --timestamp --strict -v -s "${CODESIGNID}" -i "com.rawtherapee.RawTherapee" -o runtime --entitlements "${CONTENTS}/rt.entitlements" "${APP}" -spctl -a -vvvv "${APP}" +codesign --deep --preserve-metadata=identifier,entitlements,runtime --timestamp --strict -v -s "${CODESIGNID}" -i com.rawtherapee.RawTherapee -o runtime --entitlements '${CONTENTS}/rt.entitlements' '${APP}' +spctl -a -vvvv ${APP} fi # Notarize the app @@ -331,7 +331,7 @@ hdiutil create -format UDBZ -fs HFS+ -srcdir "${srcDir}" -volname "${PROJECT_NAM # Sign disk image if ! test -z "$CODESIGNID" ; then -codesign --deep --force -v -s "${CODESIGNID}" --timestamp "${dmg_name}.dmg" +codesign --deep --force -v -s ""${CODESIGNID}"" --timestamp "${dmg_name}.dmg" fi # Notarize the dmg