summaryrefslogtreecommitdiff
path: root/src/AppDirs.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-08-17 17:10:12 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-08-17 17:10:12 +0200
commit008bc99860fd353a5da5d06e6be5937f4a358aed (patch)
treed50b38f704b90b83895a21fd610bcf78c31b2cc9 /src/AppDirs.vala
parent4ec8ba6ace7234ddc24a7d362a34d9055a83812c (diff)
parent7eef6a59ba38582bed5d459974211eb1f53e1f5d (diff)
Merge branch 'release/debian/0.32.2-1'debian/0.32.2-1
Diffstat (limited to 'src/AppDirs.vala')
-rw-r--r--src/AppDirs.vala17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/AppDirs.vala b/src/AppDirs.vala
index 20df920..05e172c 100644
--- a/src/AppDirs.vala
+++ b/src/AppDirs.vala
@@ -196,14 +196,21 @@ class AppDirs {
public static File get_temp_dir() {
if (tmp_dir == null) {
- tmp_dir = File.new_for_path(DirUtils.mkdtemp (Environment.get_tmp_dir() + "/shotwell-XXXXXX"));
+ var basedir = Environment.get_tmp_dir();
+ var flatpak_canary = File.new_for_path("/.flatpak-info");
+ if (flatpak_canary.query_exists() && basedir == "/tmp") {
+ basedir = Environment.get_user_cache_dir() + "/tmp";
+ }
+
+ tmp_dir = File.new_for_path(DirUtils.mkdtemp (basedir + "/shotwell-XXXXXX"));
try {
- if (!tmp_dir.query_exists(null))
- tmp_dir.make_directory_with_parents(null);
+ tmp_dir.make_directory_with_parents(null);
} catch (Error err) {
- AppWindow.panic(_("Unable to create temporary directory %s: %s").printf(
- tmp_dir.get_path(), err.message));
+ if (!(err is GLib.IOError.EXISTS)) {
+ AppWindow.panic(_("Unable to create temporary directory %s: %s").printf(
+ tmp_dir.get_path(), err.message));
+ }
}
}