From f22f3b5e43fe59f0b4a050017df906124ce99b3d Mon Sep 17 00:00:00 2001 From: torger Date: Mon, 11 Nov 2013 19:09:11 +0100 Subject: [PATCH] Issue 853: fixes for OS X and Linux; as options files are changed the missing .srf format is also added to the browser --- rtdata/options/options.lin | 6 +++--- rtdata/options/options.osx | 6 +++--- rtdata/options/options.win | 6 +++--- rtgui/options.cc | 21 +++++++++++++-------- rtgui/options.h | 4 ++++ rtgui/profilestore.cc | 4 ++++ 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/rtdata/options/options.lin b/rtdata/options/options.lin index 82f413c98..fcd40988f 100644 --- a/rtdata/options/options.lin +++ b/rtdata/options/options.lin @@ -12,8 +12,8 @@ MultiUser=true [File Browser] # Image filename extensions to be looked for, and their corresponding search state (0/1 -> skip/include) -ParseExtensions=3fr;arw;cr2;crf;crw;dcr;dng;fff;iiq;jpg;jpeg;kdc;mef;mos;mrw;nef;nrw;orf;pef;png;raf;raw;rw2;rwz;sr2;srw;tif;tiff; -ParseExtensionsEnabled=1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1; +ParseExtensions=3fr;arw;cr2;crf;crw;dcr;dng;fff;iiq;jpg;jpeg;kdc;mef;mos;mrw;nef;nrw;orf;pef;png;raf;raw;rw2;rwz;sr2;srf;srw;tif;tiff; +ParseExtensionsEnabled=1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1; [Output] PathTemplate=%p1/converted/%f @@ -32,7 +32,7 @@ CustomProfileBuilder= #UseBundledProfiles=true # Default profile name (without extension) to use for raw images -#RawDefault=Default +#RawDefault=${G}/Default # Default profile name (without extension) to use for standard (8bits) images #ImgDefault=Neutral diff --git a/rtdata/options/options.osx b/rtdata/options/options.osx index 04650472d..305a34a5b 100644 --- a/rtdata/options/options.osx +++ b/rtdata/options/options.osx @@ -12,8 +12,8 @@ MultiUser=true [File Browser] # Image filename extensions to be looked for, and their corresponding search state (0/1 -> skip/include) -ParseExtensions=3fr;arw;cr2;crf;crw;dcr;dng;fff;iiq;jpg;jpeg;kdc;mef;mos;mrw;nef;nrw;orf;pef;png;raf;raw;rw2;rwz;sr2;srw;tif;tiff; -ParseExtensionsEnabled=1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1; +ParseExtensions=3fr;arw;cr2;crf;crw;dcr;dng;fff;iiq;jpg;jpeg;kdc;mef;mos;mrw;nef;nrw;orf;pef;png;raf;raw;rw2;rwz;sr2;srf;srw;tif;tiff; +ParseExtensionsEnabled=1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1; [Output] PathTemplate=%p1/converted/%f @@ -35,7 +35,7 @@ Font=Sans 12 #UseBundledProfiles=true # Default profile name (without extension) to use for raw images -#RawDefault=Default +#RawDefault=${G}/Default # Default profile name (without extension) to use for standard (8bits) images #ImgDefault=Neutral diff --git a/rtdata/options/options.win b/rtdata/options/options.win index 8bda6e11b..b60109bdd 100644 --- a/rtdata/options/options.win +++ b/rtdata/options/options.win @@ -14,8 +14,8 @@ UseSystemTheme=false [File Browser] # Image filename extensions to be looked for, and their corresponding search state (0/1 -> skip/include) -ParseExtensions=3fr;arw;cr2;crf;crw;dcr;dng;fff;iiq;jpg;jpeg;kdc;mef;mos;mrw;nef;nrw;orf;pef;png;raf;raw;rw2;rwz;sr2;srw;tif;tiff; -ParseExtensionsEnabled=1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1; +ParseExtensions=3fr;arw;cr2;crf;crw;dcr;dng;fff;iiq;jpg;jpeg;kdc;mef;mos;mrw;nef;nrw;orf;pef;png;raf;raw;rw2;rwz;sr2;srf;srw;tif;tiff; +ParseExtensionsEnabled=1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1; [Output] PathTemplate=%p1/converted/%f @@ -34,7 +34,7 @@ CustomProfileBuilder= #UseBundledProfiles=true # Default profile name (without extension) to use for raw images -#RawDefault=Default +#RawDefault=${G}\\Default # Default profile name (without extension) to use for standard (8bits) images #ImgDefault=Neutral diff --git a/rtgui/options.cc b/rtgui/options.cc index 60932f54b..2379577fc 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -88,8 +88,8 @@ void Options::updatePaths() { if (Glib::path_is_absolute(profilePath)) { // absolute path if (!checkDirPath (profilePath, "")) { - int retVal = safe_g_mkdir_with_parents (profilePath, 511); - if (!retVal) + safe_g_mkdir_with_parents (profilePath, 511); + if (!checkDirPath (profilePath, "")) // had problems with mkdir_with_parents return value on OS X, just check dir again printf("Error: user's profiles' directory \"%s\" creation failed\n", profilePath.c_str()); } if (checkDirPath (profilePath, "Error: the specified user's profiles' path doesn't point to a directory or doesn't exist!\n")) { @@ -117,8 +117,8 @@ void Options::updatePaths() { if (multiUser) { tmpPath = Glib::build_filename(rtdir, profilePath); if (!checkDirPath (tmpPath, "")) { - int retVal = safe_g_mkdir_with_parents (tmpPath, 511); - if (!retVal) + safe_g_mkdir_with_parents (tmpPath, 511); + if (!checkDirPath (tmpPath, "")) printf("Error: user's profiles' directory \"%s\" creation failed\n", tmpPath.c_str()); } if(checkDirPath (tmpPath, "Error: the specified user's profiles' path doesn't point to a directory!\n")) { @@ -168,11 +168,11 @@ Glib::ustring Options::getPreferredProfilePath() { return ""; } -/** @brief Get the absolute path of the given filename or the "Internal" special value +/** @brief Get the absolute path of the given filename or the "Neutral" special value * *@param profName path + filename of the procparam to look for. A filename without path can be provided for backward compatibility. * In this case, this parameter will be update with the new format. - *@return Send back the absolute path of the given filename or "Internal" if "Internal" has been set to profName. Implementor will have + *@return Send back the absolute path of the given filename or "Neutral" if "Neutral" has been set to profName. Implementor will have * to test for this particular value. If the absolute path is invalid (e.g. the file doesn't exist), it will return an empty string. */ Glib::ustring Options::findProfilePath(Glib::ustring &profName) { @@ -186,14 +186,14 @@ Glib::ustring Options::findProfilePath(Glib::ustring &profName) { if (p=="${U}") { // the path starts by the User virtual path p = getUserProfilePath(); - Glib::ustring fullPath = p + profName.substr(4) + paramFileExtension; + Glib::ustring fullPath = Glib::build_filename(p, profName.substr(5) + paramFileExtension); if (!p.empty() && safe_file_test (fullPath, Glib::FILE_TEST_EXISTS)) return Glib::path_get_dirname(fullPath); } else if (p=="${G}") { // the path starts by the User virtual path p = getGlobalProfilePath(); - Glib::ustring fullPath = p + profName.substr(4) + paramFileExtension; + Glib::ustring fullPath = Glib::build_filename(p, profName.substr(5) + paramFileExtension); if (!p.empty() && safe_file_test (fullPath, Glib::FILE_TEST_EXISTS)) return Glib::path_get_dirname(fullPath); } @@ -1119,6 +1119,11 @@ void Options::load () { #else cacheBaseDir = Glib::build_filename(Glib::ustring(g_get_user_cache_dir()), Glib::ustring(CACHEFOLDERNAME)); #endif + +#ifdef __APPLE__ + // make sure .local/share exists on OS X so we don't get problems with recently-used.xbel + safe_g_mkdir_with_parents (g_get_user_data_dir(), 511); +#endif } // Update profile's path and recreate it if necessary diff --git a/rtgui/options.h b/rtgui/options.h index 4be423884..3e0984a69 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -28,7 +28,11 @@ #define STARTUPDIR_LAST 3 // Default bundled profile name to use for Raw images +#ifdef WIN32 #define DEFPROFILE_RAW "${G}\\Default" +#else +#define DEFPROFILE_RAW "${G}/Default" +#endif // Default bundled profile name to use for Standard images #define DEFPROFILE_IMG "Neutral" // Profile name to use for internal values' profile diff --git a/rtgui/profilestore.cc b/rtgui/profilestore.cc index 733b3c0f0..6541e10ba 100644 --- a/rtgui/profilestore.cc +++ b/rtgui/profilestore.cc @@ -247,6 +247,10 @@ const ProfileStoreEntry* ProfileStore::findEntryFromFullPathU(Glib::ustring path // removing the extension path = path.substr(0,lastdot); + // dir separator may come from options file and may be \ or /, we convert them to G_DIR_SEPARATOR_S + if (path.size() > 4 && (path[4] == '/' || path[4] == '\\')) + path = path.substr(0,4) + G_DIR_SEPARATOR_S + path.substr(5); + // removing the filename Glib::ustring fName = Glib::path_get_basename(path); if (!fName.empty()) {