Issue 853: fixes for OS X and Linux; as options files are changed the missing .srf format is also added to the browser

This commit is contained in:
torger
2013-11-11 19:09:11 +01:00
parent cdefd0c999
commit f22f3b5e43
6 changed files with 30 additions and 17 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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()) {