Fixing creation and use of profile direcory
This commit is contained in:
@@ -33,8 +33,8 @@ void CacheManager::init () {
|
||||
|
||||
if (!Glib::file_test (baseDir, Glib::FILE_TEST_IS_DIR))
|
||||
g_mkdir_with_parents (baseDir.c_str(), 511);
|
||||
if (!Glib::file_test (Glib::build_filename (baseDir, "profiles"), Glib::FILE_TEST_IS_DIR))
|
||||
g_mkdir_with_parents (Glib::ustring(Glib::build_filename (baseDir, "profiles")).c_str(), 511);
|
||||
if (!Glib::file_test (Glib::build_filename (baseDir, options.profilePath), Glib::FILE_TEST_IS_DIR))
|
||||
g_mkdir_with_parents (Glib::ustring(Glib::build_filename (baseDir, options.profilePath)).c_str(), 511);
|
||||
if (!Glib::file_test (Glib::build_filename (baseDir, "images"), Glib::FILE_TEST_IS_DIR))
|
||||
g_mkdir_with_parents (Glib::ustring(Glib::build_filename (baseDir, "images")).c_str(), 511);
|
||||
if (!Glib::file_test (Glib::build_filename (baseDir, "aehistograms"), Glib::FILE_TEST_IS_DIR))
|
||||
@@ -103,7 +103,7 @@ void CacheManager::deleteEntry (const Glib::ustring& fname) {
|
||||
r = openEntries.find (fname);
|
||||
if (r==openEntries.end() && md5!="") {
|
||||
::g_remove ((getCacheFileName ("data", fname, md5) + ".txt").c_str());
|
||||
::g_remove ((getCacheFileName ("profiles", fname, md5) + paramFileExtension).c_str());
|
||||
::g_remove ((getCacheFileName (options.profilePath, fname, md5) + paramFileExtension).c_str());
|
||||
::g_remove ((getCacheFileName ("images", fname, md5) + ".cust").c_str());
|
||||
::g_remove ((getCacheFileName ("images", fname, md5) + ".jpg").c_str());
|
||||
::g_remove ((getCacheFileName ("aehistograms", fname, md5)).c_str());
|
||||
@@ -114,7 +114,7 @@ void CacheManager::deleteEntry (const Glib::ustring& fname) {
|
||||
std::string md5 = getMD5 (fname);
|
||||
if (md5!="") {
|
||||
::g_remove ((getCacheFileName ("data", fname, md5) + ".txt").c_str());
|
||||
::g_remove ((getCacheFileName ("profiles", fname, md5) + paramFileExtension).c_str());
|
||||
::g_remove ((getCacheFileName (options.profilePath, fname, md5) + paramFileExtension).c_str());
|
||||
::g_remove ((getCacheFileName ("images", fname, md5) + ".cust").c_str());
|
||||
::g_remove ((getCacheFileName ("images", fname, md5) + ".jpg").c_str());
|
||||
::g_remove ((getCacheFileName ("aehistograms", fname, md5)).c_str());
|
||||
@@ -128,7 +128,7 @@ void CacheManager::renameEntry (const std::string& oldfilename, const std::strin
|
||||
|
||||
std::string newmd5 = getMD5 (newfilename);
|
||||
|
||||
::g_rename ((getCacheFileName ("profiles", oldfilename, oldmd5) + paramFileExtension).c_str(), (getCacheFileName ("profiles", newfilename, newmd5) + paramFileExtension).c_str());
|
||||
::g_rename ((getCacheFileName (options.profilePath, oldfilename, oldmd5) + paramFileExtension).c_str(), (getCacheFileName (options.profilePath, newfilename, newmd5) + paramFileExtension).c_str());
|
||||
::g_rename ((getCacheFileName ("images", oldfilename, oldmd5) + ".cust").c_str(), (getCacheFileName ("images", newfilename, newmd5) + ".cust").c_str());
|
||||
::g_rename ((getCacheFileName ("images", oldfilename, oldmd5) + ".jpg").c_str(), (getCacheFileName ("images", newfilename, newmd5) + ".jpg").c_str());
|
||||
::g_rename ((getCacheFileName ("aehistograms", oldfilename, oldmd5)).c_str(), (getCacheFileName ("aehistograms", newfilename, newmd5)).c_str());
|
||||
@@ -167,7 +167,7 @@ void CacheManager::clearAll () {
|
||||
deleteDir ("images");
|
||||
deleteDir ("aehistograms");
|
||||
deleteDir ("embprofiles");
|
||||
deleteDir ("profiles");
|
||||
deleteDir (options.profilePath);
|
||||
deleteDir ("data");
|
||||
|
||||
// re-generate thumbnail images and clear profiles of open thumbnails
|
||||
@@ -192,7 +192,7 @@ void CacheManager::clearThumbImages () {
|
||||
|
||||
void CacheManager::clearProfiles () {
|
||||
|
||||
deleteDir ("profiles");
|
||||
deleteDir (options.profilePath);
|
||||
// clear profiles of open thumbnails
|
||||
std::map<std::string, Thumbnail*>::iterator i;
|
||||
for (i=openEntries.begin(); i!=openEntries.end(); i++)
|
||||
@@ -245,7 +245,7 @@ void CacheManager::applyCacheSizeLimitation () {
|
||||
::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "images"), flist.front().fname) + ".jpg").c_str());
|
||||
::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "aehistograms"), flist.front().fname)).c_str());
|
||||
::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "embprofiles"), flist.front().fname) + ".icc").c_str());
|
||||
// ::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, "profiles"), flist.front().fname) + paramFileExtension).c_str());
|
||||
// ::g_remove ((Glib::build_filename (Glib::build_filename (baseDir, options.profilePath), flist.front().fname) + paramFileExtension).c_str());
|
||||
flist.erase (flist.begin());
|
||||
}
|
||||
}
|
||||
|
@@ -430,8 +430,6 @@ void Options::load () {
|
||||
if (options.multiUser) {
|
||||
int r = options.readFromFile (rtdir + "/options");
|
||||
if (r && !g_mkdir_with_parents (rtdir.c_str(), 511)) {
|
||||
Glib::ustring profdir = rtdir + "/profiles";
|
||||
g_mkdir_with_parents (profdir.c_str(), 511);
|
||||
options.saveToFile (rtdir + "/options");
|
||||
}
|
||||
#ifdef _WIN32
|
||||
|
@@ -329,7 +329,7 @@ Gtk::Widget* Preferences::getProcParamsPanel () {
|
||||
|
||||
std::vector<Glib::ustring> pnames;
|
||||
if (options.multiUser)
|
||||
parseDir (Options::rtdir + "/" + options.profilePath, pnames, paramFileExtension);
|
||||
parseDir (Options::cacheBaseDir + "/" + options.profilePath, pnames, paramFileExtension);
|
||||
parseDir (argv0 + "/" + options.profilePath, pnames, paramFileExtension);
|
||||
for (int i=0; i<pnames.size(); i++) {
|
||||
rprofiles->append_text (pnames[i]);
|
||||
|
@@ -114,7 +114,7 @@ void ProfilePanel::save_clicked () {
|
||||
|
||||
Gtk::FileChooserDialog dialog(M("PROFILEPANEL_SAVEDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_SAVE);
|
||||
if (options.multiUser)
|
||||
dialog.set_current_folder (Options::rtdir + "/" + options.profilePath);
|
||||
dialog.set_current_folder (Options::cacheBaseDir + "/" + options.profilePath);
|
||||
else
|
||||
dialog.set_current_folder (argv0 + "/" + options.profilePath);
|
||||
|
||||
@@ -203,7 +203,7 @@ void ProfilePanel::load_clicked () {
|
||||
|
||||
Gtk::FileChooserDialog dialog(M("PROFILEPANEL_LOADDLGLABEL"), Gtk::FILE_CHOOSER_ACTION_OPEN);
|
||||
if (options.multiUser)
|
||||
dialog.set_current_folder (Options::rtdir + "/" + options.profilePath);
|
||||
dialog.set_current_folder (Options::cacheBaseDir + "/" + options.profilePath);
|
||||
else
|
||||
dialog.set_current_folder (argv0 + "/" + options.profilePath);
|
||||
|
||||
|
@@ -35,7 +35,7 @@ void ProfileStore::parseProfiles () {
|
||||
pparams.clear ();
|
||||
|
||||
if (options.multiUser) {
|
||||
Glib::ustring userPD = options.rtdir + "/" + options.profilePath;
|
||||
Glib::ustring userPD = options.cacheBaseDir + "/" + options.profilePath;
|
||||
if (!Glib::file_test (userPD, Glib::FILE_TEST_IS_DIR))
|
||||
g_mkdir_with_parents (userPD.c_str(), 511);
|
||||
parseDir (userPD);
|
||||
|
@@ -149,11 +149,11 @@ void Thumbnail::loadProcParams () {
|
||||
int ppres = pparams.load (fname + paramFileExtension);
|
||||
pparamsValid = !ppres && pparams.version>=220;
|
||||
if (!pparamsValid)
|
||||
pparamsValid = !pparams.load (getCacheFileName ("profiles")+paramFileExtension);
|
||||
pparamsValid = !pparams.load (getCacheFileName (options.profilePath)+paramFileExtension);
|
||||
}
|
||||
else {
|
||||
// try to load it from cache
|
||||
pparamsValid = !pparams.load (getCacheFileName ("profiles")+paramFileExtension);
|
||||
pparamsValid = !pparams.load (getCacheFileName (options.profilePath)+paramFileExtension);
|
||||
// if no success, load it from params file next to the image file
|
||||
if (!pparamsValid) {
|
||||
int ppres = pparams.load (fname + paramFileExtension);
|
||||
@@ -168,7 +168,7 @@ void Thumbnail::clearProcParams (int whoClearedIt) {
|
||||
pparamsValid = false;
|
||||
needsReProcessing = true;
|
||||
// remove param file from cache
|
||||
Glib::ustring fname_ = getCacheFileName ("profiles")+paramFileExtension;
|
||||
Glib::ustring fname_ = getCacheFileName (options.profilePath)+paramFileExtension;
|
||||
if (Glib::file_test (fname_, Glib::FILE_TEST_EXISTS))
|
||||
::g_remove (fname_.c_str());
|
||||
// remove param file located next to the file
|
||||
@@ -213,7 +213,7 @@ void Thumbnail::imageDeveloped () {
|
||||
|
||||
cfs.recentlySaved = true;
|
||||
cfs.save (getCacheFileName ("data")+".txt");
|
||||
pparams.save (getCacheFileName ("profiles")+paramFileExtension);
|
||||
pparams.save (getCacheFileName (options.profilePath)+paramFileExtension);
|
||||
}
|
||||
|
||||
void Thumbnail::imageEnqueued () {
|
||||
@@ -410,7 +410,7 @@ void Thumbnail::updateCache () {
|
||||
|
||||
if (pparamsValid) {
|
||||
if (options.saveParamsCache)
|
||||
pparams.save (getCacheFileName ("profiles")+paramFileExtension);
|
||||
pparams.save (getCacheFileName (options.profilePath)+paramFileExtension);
|
||||
if (options.saveParamsFile)
|
||||
// pparams.save (removeExtension(fname) + paramFileExtension);
|
||||
pparams.save (fname + paramFileExtension);
|
||||
|
Reference in New Issue
Block a user