mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-14 15:53:36 +01:00
fixed issue #570 - each instance of dependency-check will have its own temporary folder
This commit is contained in:
@@ -293,7 +293,8 @@ public final class Settings {
|
||||
*/
|
||||
public static final String ANALYZER_COCOAPODS_ENABLED = "analyzer.cocoapods.enabled";
|
||||
/**
|
||||
* The properties key for whether the SWIFT package manager analyzer is enabled.
|
||||
* The properties key for whether the SWIFT package manager analyzer is
|
||||
* enabled.
|
||||
*/
|
||||
public static final String ANALYZER_SWIFT_PACKAGE_MANAGER_ENABLED = "analyzer.swift.package.manager.enabled";
|
||||
/**
|
||||
@@ -425,14 +426,7 @@ public final class Settings {
|
||||
public static void cleanup(boolean deleteTemporary) {
|
||||
if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
|
||||
FileUtils.delete(tempDirectory);
|
||||
if (tempDirectory.exists()) {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException ex) {
|
||||
LOGGER.trace("ignore", ex);
|
||||
}
|
||||
FileUtils.delete(tempDirectory);
|
||||
}
|
||||
tempDirectory = null;
|
||||
}
|
||||
try {
|
||||
LOCAL_SETTINGS.remove();
|
||||
@@ -746,14 +740,12 @@ public final class Settings {
|
||||
* @throws java.io.IOException thrown if the temporary directory does not
|
||||
* exist and cannot be created
|
||||
*/
|
||||
public static File getTempDirectory() throws IOException {
|
||||
final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")), "dctemp");
|
||||
if (!tmpDir.exists() && !tmpDir.mkdirs()) {
|
||||
final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath());
|
||||
throw new IOException(msg);
|
||||
public static synchronized File getTempDirectory() throws IOException {
|
||||
if (tempDirectory == null) {
|
||||
final File baseTemp = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")));
|
||||
tempDirectory = FileUtils.createTempDirectory(baseTemp);
|
||||
}
|
||||
tempDirectory = tmpDir;
|
||||
return tmpDir;
|
||||
return tempDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user