mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-09-23 14:34:49 -04:00
fix windows file rename bug
This commit is contained in:
parent
db4c3d9aa0
commit
955c2ba4d4
2 changed files with 7 additions and 3 deletions
|
@ -10,6 +10,7 @@ Then you can generate coins on demand with the Bitcoin qt client with that comma
|
||||||
See: https://bitcoinj.github.io/testing
|
See: https://bitcoinj.github.io/testing
|
||||||
You can change the network mode in the guice module: BitSquareModule.java
|
You can change the network mode in the guice module: BitSquareModule.java
|
||||||
|
|
||||||
|
If you want to
|
||||||
|
|
||||||
### Resources:
|
### Resources:
|
||||||
* Web: http://bitsquare.io
|
* Web: http://bitsquare.io
|
||||||
|
|
|
@ -234,12 +234,15 @@ public class Storage
|
||||||
|
|
||||||
if (Utils.isWindows())
|
if (Utils.isWindows())
|
||||||
{
|
{
|
||||||
// Work around an issue on Windows whereby you can't rename over existing files.
|
|
||||||
final File canonical = storageFile.getCanonicalFile();
|
final File canonical = storageFile.getCanonicalFile();
|
||||||
if (canonical.exists() && !canonical.delete())
|
if (!canonical.exists())
|
||||||
{
|
{
|
||||||
throw new IOException("Failed to delete canonical file for replacement with save");
|
if (!canonical.createNewFile())
|
||||||
|
{
|
||||||
|
throw new IOException("Failed to create new file " + canonical);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tempFile.renameTo(canonical))
|
if (!tempFile.renameTo(canonical))
|
||||||
{
|
{
|
||||||
throw new IOException("Failed to rename " + tempFile + " to " + canonical);
|
throw new IOException("Failed to rename " + tempFile + " to " + canonical);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue