diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-08-17 17:10:12 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-08-17 17:10:12 +0200 |
commit | 008bc99860fd353a5da5d06e6be5937f4a358aed (patch) | |
tree | d50b38f704b90b83895a21fd610bcf78c31b2cc9 /src/AppDirs.vala | |
parent | 4ec8ba6ace7234ddc24a7d362a34d9055a83812c (diff) | |
parent | 7eef6a59ba38582bed5d459974211eb1f53e1f5d (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.vala | 17 |
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)); + } } } |