fixed bug related to temp files

Former-commit-id: 3d1a5c6d30411ab026b2f072a8aee25106bf9691
This commit is contained in:
Jeremy Long
2015-06-13 08:30:05 -04:00
parent 084371a1e3
commit 4d3f96f979

View File

@@ -337,7 +337,7 @@ public final class Settings {
*/ */
public static void cleanup(boolean deleteTemporary) { public static void cleanup(boolean deleteTemporary) {
if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) { if (deleteTemporary && tempDirectory != null && tempDirectory.exists()) {
FileUtils.delete(tempDirectory); //FileUtils.delete(tempDirectory);
} }
try { try {
localSettings.remove(); localSettings.remove();
@@ -586,15 +586,14 @@ public final class Settings {
* @throws java.io.IOException thrown if the temporary directory does not exist and cannot be created * @throws java.io.IOException thrown if the temporary directory does not exist and cannot be created
*/ */
public static File getTempDirectory() throws IOException { public static File getTempDirectory() throws IOException {
final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir"))); final File tmpDir = new File(Settings.getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")), "dctemp");
if (!tmpDir.exists()) { if (!tmpDir.exists()) {
if (!tmpDir.mkdirs()) { if (!tmpDir.mkdirs()) {
final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath()); final String msg = String.format("Unable to make a temporary folder '%s'", tmpDir.getPath());
throw new IOException(msg); throw new IOException(msg);
} else {
tempDirectory = tmpDir;
} }
} }
tempDirectory = tmpDir;
return tmpDir; return tmpDir;
} }