mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-12-14 23:44:51 -05:00
fix problem with temp file on win8
This commit is contained in:
parent
ec494136ed
commit
99d00500de
1 changed files with 14 additions and 1 deletions
|
|
@ -20,7 +20,14 @@ public class FileUtil
|
||||||
|
|
||||||
public static File getTempFile(String prefix) throws IOException
|
public static File getTempFile(String prefix) throws IOException
|
||||||
{
|
{
|
||||||
return File.createTempFile("temp_" + prefix, null, StorageDirectory.getStorageDirectory());
|
if (Utils.isWindows())
|
||||||
|
{
|
||||||
|
return getFile("temp_" + prefix, ".tmp");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return File.createTempFile("temp_" + prefix, null, StorageDirectory.getStorageDirectory());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getApplicationFileName()
|
public static String getApplicationFileName()
|
||||||
|
|
@ -55,6 +62,7 @@ public class FileUtil
|
||||||
return BitSquare.getAppName();
|
return BitSquare.getAppName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void writeTempFileToFile(File tempFile, File file) throws IOException
|
public static void writeTempFileToFile(File tempFile, File file) throws IOException
|
||||||
{
|
{
|
||||||
if (Utils.isWindows())
|
if (Utils.isWindows())
|
||||||
|
|
@ -64,6 +72,11 @@ public class FileUtil
|
||||||
file.delete();
|
file.delete();
|
||||||
final File canonicalFile = new File(canonicalPath);
|
final File canonicalFile = new File(canonicalPath);
|
||||||
Files.copy(tempFile.toPath(), canonicalFile.toPath());
|
Files.copy(tempFile.toPath(), canonicalFile.toPath());
|
||||||
|
|
||||||
|
if (tempFile.exists() && !tempFile.delete())
|
||||||
|
{
|
||||||
|
log.error("Cannot delete temp file.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue