From b761674b2c56994240abc1e18c1599330b6f8562 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Sun, 14 Nov 2021 17:00:49 +0000 Subject: [PATCH] Default temp path moved to a subfolder of the data path This allows users to set only their data path, and for the temp folder to automatically follow it. The temp folder can be moved to a custom location by setting the "tempDataPath" setting. --- src/main/java/org/qortal/settings/Settings.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/qortal/settings/Settings.java b/src/main/java/org/qortal/settings/Settings.java index b2723328..35f6cd3e 100644 --- a/src/main/java/org/qortal/settings/Settings.java +++ b/src/main/java/org/qortal/settings/Settings.java @@ -5,6 +5,7 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; +import java.nio.file.Paths; import java.util.*; import javax.xml.bind.JAXBContext; @@ -264,7 +265,7 @@ public class Settings { /** Data storage path. */ private String dataPath = "data"; /** Data storage path (for temporary data). */ - private String tempDataPath = "data/_temp"; + private String tempDataPath = null; /** Storage policy to indicate which data should be hosted */ private String storagePolicy = "FOLLOWED_AND_VIEWED"; @@ -783,7 +784,11 @@ public class Settings { } public String getTempDataPath() { - return this.tempDataPath; + if (this.tempDataPath != null) { + return this.tempDataPath; + } + // Default the temp path to a "_temp" folder inside the data directory + return Paths.get(this.getDataPath(), "_temp").toString(); } public StoragePolicy getStoragePolicy() {