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.
This commit is contained in:
CalDescent 2021-11-14 17:00:49 +00:00
parent 0b20bf0145
commit b761674b2c

View File

@ -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,8 +784,12 @@ public class Settings {
}
public String getTempDataPath() {
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() {
return StoragePolicy.valueOf(this.storagePolicy);