File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
code/src/main/java/com/codeforces/commons Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -899,9 +899,15 @@ private static class TempDirHolder {
899
899
900
900
private static String initializeTempDir () {
901
901
try {
902
+ String tempDirParent = CommonsPropertiesUtil .getApplicationTempDirParent ();
903
+ if (tempDirParent != null ) {
904
+ ensureDirectoryExists (new File (tempDirParent ));
905
+ }
906
+
902
907
String tempDirName = CommonsPropertiesUtil .getApplicationTempDirName ();
903
908
904
- File dir = File .createTempFile (tempDirName , "" );
909
+ File dir = File .createTempFile (tempDirName , "" ,
910
+ tempDirParent == null ? null : new File (tempDirParent ));
905
911
File temp = new File (dir .getParentFile (), tempDirName );
906
912
907
913
if (!dir .delete ()) {
Original file line number Diff line number Diff line change 1
1
package com .codeforces .commons .properties .internal ;
2
2
3
3
import com .codeforces .commons .properties .PropertiesUtil ;
4
+ import com .codeforces .commons .text .StringUtil ;
4
5
6
+ import java .io .File ;
5
7
import java .util .List ;
6
8
9
+ import javax .annotation .Nullable ;
10
+
7
11
/**
8
12
* @author Mike Mirzayanov
9
13
* @author Maxim Shipko ([email protected] )
@@ -30,6 +34,11 @@ public static String getApplicationTempDirName() {
30
34
return PropertyValuesHolder .TEMP_DIR_NAME ;
31
35
}
32
36
37
+ @ Nullable
38
+ public static String getApplicationTempDirParent () {
39
+ return PropertyValuesHolder .TEMP_DIR_PARENT ;
40
+ }
41
+
33
42
public static List <String > getSecurePasswords () {
34
43
return PropertyValuesHolder .SECURE_PASSWORDS ;
35
44
}
@@ -52,6 +61,8 @@ public static String getSubscriptionToken() {
52
61
53
62
private static final class PropertyValuesHolder {
54
63
private static final String TEMP_DIR_NAME = getProperty ("temp-dir.name" , "temp" );
64
+ @ Nullable
65
+ private static final String TEMP_DIR_PARENT = StringUtil .trimToNull (getProperty ("temp-dir.parent" , null ));
55
66
private static final List <String > SECURE_PASSWORDS = getListProperty ("security.secure-passwords" , "" );
56
67
private static final List <String > SECURE_HOSTS = getListProperty ("security.secure-hosts" , "" );
57
68
private static final boolean BYPASS_CERTIFICATE_CHECK
You can’t perform that action at this time.
0 commit comments