-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use temp dir env var only in apps
- Loading branch information
Showing
15 changed files
with
172 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
jadx-commons/jadx-app-commons/src/main/java/jadx/commons/app/JadxTempFiles.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package jadx.commons.app; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
public class JadxTempFiles { | ||
private static final String JADX_TMP_INSTANCE_PREFIX = "jadx-instance-"; | ||
|
||
private static final Path TEMP_ROOT_DIR = createTempRootDir(); | ||
|
||
public static Path getTempRootDir() { | ||
return TEMP_ROOT_DIR; | ||
} | ||
|
||
private static Path createTempRootDir() { | ||
try { | ||
String jadxTmpDir = System.getenv("JADX_TMP_DIR"); | ||
Path dir; | ||
if (jadxTmpDir != null) { | ||
dir = Files.createTempDirectory(Paths.get(jadxTmpDir), JADX_TMP_INSTANCE_PREFIX); | ||
} else { | ||
dir = Files.createTempDirectory(JADX_TMP_INSTANCE_PREFIX); | ||
} | ||
dir.toFile().deleteOnExit(); | ||
return dir; | ||
} catch (Exception e) { | ||
throw new RuntimeException("Failed to create temp root directory", e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.