mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-09 15:29:20 -04:00
fix detection of temporary folder
This commit is contained in:
parent
9ca097ccae
commit
f7e0beb537
@ -27,6 +27,7 @@ public class StaticConfiguration {
|
|||||||
public static boolean LOG_RELATIVE_TIME = false; // prefix all log messages with the relative start time in milliseconds instead of the formatted time
|
public static boolean LOG_RELATIVE_TIME = false; // prefix all log messages with the relative start time in milliseconds instead of the formatted time
|
||||||
public static boolean VERBOSE_ENTITY_META_DATA_LOGGING = false; // if true, the entity meta data is getting serialized
|
public static boolean VERBOSE_ENTITY_META_DATA_LOGGING = false; // if true, the entity meta data is getting serialized
|
||||||
public static String HOME_DIRECTORY;
|
public static String HOME_DIRECTORY;
|
||||||
|
public static final String TEMPORARY_FOLDER = System.getProperty("java.io.tmpdir", HOME_DIRECTORY + "/tmp/") + "/";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Sets Config.homeDir to the correct folder per OS
|
// Sets Config.homeDir to the correct folder per OS
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.data.assets;
|
package de.bixilon.minosoft.data.assets;
|
||||||
|
|
||||||
import com.google.common.base.StandardSystemProperty;
|
|
||||||
import com.google.errorprone.annotations.DoNotCall;
|
import com.google.errorprone.annotations.DoNotCall;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
@ -258,8 +257,7 @@ public class AssetsManager {
|
|||||||
private static String saveAsset(InputStream data) throws IOException {
|
private static String saveAsset(InputStream data) throws IOException {
|
||||||
File tempDestinationFile = null;
|
File tempDestinationFile = null;
|
||||||
while (tempDestinationFile == null || tempDestinationFile.exists()) { // file exist? lol
|
while (tempDestinationFile == null || tempDestinationFile.exists()) { // file exist? lol
|
||||||
//noinspection ConstantConditions
|
tempDestinationFile = new File(StaticConfiguration.TEMPORARY_FOLDER + "minosoft/" + Util.generateRandomString(32));
|
||||||
tempDestinationFile = new File(System.getProperty(StandardSystemProperty.JAVA_IO_TMPDIR.value()) + "/minosoft/" + Util.generateRandomString(32));
|
|
||||||
}
|
}
|
||||||
Util.createParentFolderIfNotExist(tempDestinationFile);
|
Util.createParentFolderIfNotExist(tempDestinationFile);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user