diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-08-12 10:08:29 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-08-12 10:08:29 +0200 |
commit | f87eb3c1043d3f4f8e22ba505cd1a827241e160c (patch) | |
tree | e46351c8ec622c9d13232cf00c8a1048e55184af /src/AppDirs.vala | |
parent | 7f667adb7b8d3a803a6cd6120dcea4ba4ff89075 (diff) | |
parent | 2333d2b06d52754a55a747fa438844286f98d53a (diff) |
Merge branch 'feature/upstream' into develop
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)); + } } } |