summaryrefslogtreecommitdiff
path: root/src/AppDirs.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-06-14 20:36:37 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-06-14 20:36:37 +0200
commitbb80d3feebdc9acc52e3f4ad24084d8425f043a2 (patch)
tree2084a84c39f159c6aea254775dc0880d52579d45 /src/AppDirs.vala
parentb26ff0798252a1a8072dd2c7a67f6205de9fde11 (diff)
parent31804433d72460cbe0a39f9f8ea5e76058d84cda (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/AppDirs.vala')
-rw-r--r--src/AppDirs.vala58
1 files changed, 46 insertions, 12 deletions
diff --git a/src/AppDirs.vala b/src/AppDirs.vala
index 6c4541c..20df920 100644
--- a/src/AppDirs.vala
+++ b/src/AppDirs.vala
@@ -169,15 +169,14 @@ class AppDirs {
}
// Library folder + photo folder, based on user's preferred directory pattern.
- public static File get_baked_import_dir(time_t tm) {
+ public static File get_baked_import_dir(DateTime tm) {
string? pattern = Config.Facade.get_instance().get_directory_pattern();
if (is_string_empty(pattern))
pattern = Config.Facade.get_instance().get_directory_pattern_custom();
if (is_string_empty(pattern))
pattern = "%Y" + Path.DIR_SEPARATOR_S + "%m" + Path.DIR_SEPARATOR_S + "%d"; // default
- DateTime date = new DateTime.from_unix_local(tm);
- return File.new_for_path(get_import_dir().get_path() + Path.DIR_SEPARATOR_S + date.format(pattern));
+ return File.new_for_path(get_import_dir().get_path() + Path.DIR_SEPARATOR_S + tm.to_local().format(pattern));
}
// Returns true if the File is in or is equal to the library/import directory.
@@ -210,7 +209,7 @@ class AppDirs {
return tmp_dir;
}
-
+
public static File get_data_subdir(string name, string? subname = null) {
File subdir = get_data_dir().get_child(name);
if (subname != null)
@@ -262,7 +261,7 @@ class AppDirs {
File? install_dir = get_install_dir();
return (install_dir != null) ? install_dir.get_child("share").get_child("shotwell")
- : get_exec_dir();
+ : get_lib_dir();
}
public static File get_lib_dir() {
@@ -317,32 +316,67 @@ class AppDirs {
return f;
}
+ public static File get_metadata_helper() {
+ const string filename = "shotwell-video-metadata-handler";
+ File f = AppDirs.get_libexec_dir().get_child("video-support").get_child (filename);
+ if (!f.query_exists()) {
+ // If we're running installed.
+ f = AppDirs.get_libexec_dir () .get_child ("shotwell").get_child (filename);
+ }
+ return f;
+ }
+
public static File get_settings_migrator_bin() {
const string filename = "shotwell-settings-migrator";
- File f = AppDirs.get_libexec_dir().get_child ("settings-migrator").get_child (filename);
+ File f = AppDirs.get_libexec_dir().get_child("settings-migrator").get_child (filename);
if (!f.query_exists()) {
// If we're running installed.
f = AppDirs.get_libexec_dir () .get_child ("shotwell").get_child (filename);
}
+
+ if (!f.query_exists()) {
+ f = AppDirs.get_libexec_dir().get_parent().get_child("settings-migrator").get_child(filename);
+ }
+
return f;
}
+ public static File get_haarcascade_file() {
+ const string filename = "facedetect-haarcascade.xml";
+ var f = AppDirs.get_resources_dir().get_parent().get_child("subprojects").get_child("shotwell-facedetect").get_child (filename);
+ if (f.query_exists()) {//testing meson builddir
+ return f;
+ }
+ return get_resources_dir().get_child("facedetect-haarcascade.xml");
+ }
+
+
+#if ENABLE_FACE_DETECTION
public static File get_facedetect_bin() {
const string filename = "shotwell-facedetect";
- File f = AppDirs.get_libexec_dir().get_parent().get_child("facedetect").get_child (filename);
+ File f = AppDirs.get_libexec_dir().get_parent().get_child("subprojects").get_child(filename).get_child (filename);
if (!f.query_exists()) {
f = AppDirs.get_libexec_dir().get_child("shotwell").get_child(filename);
}
return f;
}
-
- public static File get_haarcascade_file() {
- File f = File.new_for_path(AppDirs.get_exec_dir().get_parent().get_parent().get_child("facedetect").get_child("facedetect-haarcascade.xml").get_path());
+
+ public static File get_openface_dnn_dir() {
+ return File.new_for_path(Environment.get_user_data_dir()).get_child(DEFAULT_DATA_DIR).get_child("facedetect");
+ }
+
+ public static File get_openface_dnn_system_dir() {
+ var f = File.new_for_path("/app/extra");
+ if (f.query_exists())
+ return f;
+
+ f = AppDirs.get_resources_dir().get_parent().get_child("subprojects").get_child("shotwell-facedetect");
if (f.query_exists()) {//testing meson builddir
return f;
}
- return get_resources_dir().get_child("facedetect-haarcascade.xml");
+
+ return AppDirs.get_resources_dir().get_child("facedetect");
}
+#endif
}
-