merge branch 'user-dcp-profiles-dir'
This commit is contained in:
commit
09b5dca08d
@ -1795,51 +1795,51 @@ void DCPStore::init(const Glib::ustring& rt_profile_dir, bool loadAll)
|
|||||||
file_std_profiles.clear();
|
file_std_profiles.clear();
|
||||||
|
|
||||||
if (!loadAll) {
|
if (!loadAll) {
|
||||||
profileDir.assign (rt_profile_dir);
|
profileDir = { rt_profile_dir, Glib::build_filename(options.rtdir, "dcpprofiles") };
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rt_profile_dir.empty()) {
|
std::deque<Glib::ustring> dirs = {
|
||||||
std::deque<Glib::ustring> dirs = {
|
rt_profile_dir,
|
||||||
rt_profile_dir
|
Glib::build_filename(options.rtdir, "dcpprofiles")
|
||||||
};
|
};
|
||||||
|
|
||||||
while (!dirs.empty()) {
|
while (!dirs.empty()) {
|
||||||
// Process directory
|
// Process directory
|
||||||
const Glib::ustring dirname = dirs.back();
|
const Glib::ustring dirname = dirs.back();
|
||||||
dirs.pop_back();
|
dirs.pop_back();
|
||||||
|
|
||||||
std::unique_ptr<Glib::Dir> dir;
|
std::unique_ptr<Glib::Dir> dir;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!Glib::file_test(dirname, Glib::FILE_TEST_IS_DIR)) {
|
if (!Glib::file_test(dirname, Glib::FILE_TEST_IS_DIR)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dir.reset(new Glib::Dir(dirname));
|
|
||||||
} catch (Glib::Exception& exception) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const Glib::ustring& sname : *dir) {
|
dir.reset(new Glib::Dir(dirname));
|
||||||
const Glib::ustring fname = Glib::build_filename(dirname, sname);
|
} catch (Glib::Exception& exception) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Glib::file_test(fname, Glib::FILE_TEST_IS_DIR)) {
|
for (const Glib::ustring& sname : *dir) {
|
||||||
// File
|
const Glib::ustring fname = Glib::build_filename(dirname, sname);
|
||||||
const auto lastdot = sname.rfind('.');
|
|
||||||
|
|
||||||
if (
|
if (!Glib::file_test(fname, Glib::FILE_TEST_IS_DIR)) {
|
||||||
lastdot != Glib::ustring::npos
|
// File
|
||||||
&& lastdot <= sname.size() - 4
|
const auto lastdot = sname.rfind('.');
|
||||||
&& !sname.casefold().compare(lastdot, 4, ".dcp")
|
|
||||||
|
if (
|
||||||
|
lastdot != Glib::ustring::npos
|
||||||
|
&& lastdot <= sname.size() - 4
|
||||||
|
&& !sname.casefold().compare(lastdot, 4, ".dcp")
|
||||||
) {
|
) {
|
||||||
const Glib::ustring cam_short_name = sname.substr(0, lastdot).uppercase();
|
const Glib::ustring cam_short_name = sname.substr(0, lastdot).uppercase();
|
||||||
file_std_profiles[cam_short_name] = fname; // They will be loaded and cached on demand
|
file_std_profiles[cam_short_name] = fname; // They will be loaded and cached on demand
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Directory
|
|
||||||
dirs.push_front(fname);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Directory
|
||||||
|
dirs.push_front(fname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1850,7 +1850,6 @@ void DCPStore::init(const Glib::ustring& rt_profile_dir, bool loadAll)
|
|||||||
|
|
||||||
if (real != file_std_profiles.end()) {
|
if (real != file_std_profiles.end()) {
|
||||||
file_std_profiles[alias_name] = real->second;
|
file_std_profiles[alias_name] = real->second;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1907,11 +1906,13 @@ DCPProfile* DCPStore::getStdProfile(const Glib::ustring& requested_cam_short_nam
|
|||||||
}
|
}
|
||||||
|
|
||||||
// profile not found, looking if we're in loadAll=false mode
|
// profile not found, looking if we're in loadAll=false mode
|
||||||
if (!profileDir.empty()) {
|
for (const auto &dir : profileDir) {
|
||||||
const Glib::ustring fname = Glib::build_filename(profileDir, requested_cam_short_name + Glib::ustring(".dcp"));
|
if (!dir.empty()) {
|
||||||
|
const Glib::ustring fname = Glib::build_filename(dir, requested_cam_short_name + Glib::ustring(".dcp"));
|
||||||
|
|
||||||
if (Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) {
|
if (Glib::file_test(fname, Glib::FILE_TEST_EXISTS)) {
|
||||||
return getProfile(fname);
|
return getProfile(fname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ private:
|
|||||||
DCPStore() = default;
|
DCPStore() = default;
|
||||||
|
|
||||||
mutable MyMutex mutex;
|
mutable MyMutex mutex;
|
||||||
Glib::ustring profileDir;
|
std::vector<Glib::ustring> profileDir;
|
||||||
|
|
||||||
// these contain standard profiles from RT. keys are all in uppercase, file path is value
|
// these contain standard profiles from RT. keys are all in uppercase, file path is value
|
||||||
std::map<Glib::ustring, Glib::ustring> file_std_profiles;
|
std::map<Glib::ustring, Glib::ustring> file_std_profiles;
|
||||||
|
@ -334,6 +334,8 @@ public:
|
|||||||
fileStdProfilesFileNames.clear();
|
fileStdProfilesFileNames.clear();
|
||||||
if (loadAll) {
|
if (loadAll) {
|
||||||
loadProfiles(stdProfilesDir, nullptr, nullptr, &fileStdProfilesFileNames, true);
|
loadProfiles(stdProfilesDir, nullptr, nullptr, &fileStdProfilesFileNames, true);
|
||||||
|
Glib::ustring user_input_icc_dir = Glib::build_filename(options.rtdir, "iccprofiles", "input");
|
||||||
|
loadProfiles(user_input_icc_dir, nullptr, nullptr, &fileStdProfilesFileNames, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultMonitorProfile = settings->monitorProfile;
|
defaultMonitorProfile = settings->monitorProfile;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user