summaryrefslogtreecommitdiff
path: root/src/AppDirs.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-08-12 10:07:35 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-08-12 10:07:35 +0200
commitd0aaad443a88968dc61172c050084d3d9faa7602 (patch)
treeba9356dd1659416b3217c19bbebda413b8786021 /src/AppDirs.vala
parentd443a3c2509889533ca812c163056bace396b586 (diff)
New upstream version 0.32.2upstream/0.32.2
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));
+ }
}
}