mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 15:22:16 +00:00
renaming to nonexisting file on Windows
The method fails in case the file does not exists before renaming. canonical.delete() returns false in that case and the method throws an exception.
This commit is contained in:
parent
0442448621
commit
c37423a737
@ -328,7 +328,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
||||
if (Utils.isWindows()) {
|
||||
// Work around an issue on Windows whereby you can't rename over existing files.
|
||||
File canonical = destFile.getCanonicalFile();
|
||||
if (!canonical.delete())
|
||||
if (canonical.exists() && !canonical.delete())
|
||||
throw new IOException("Failed to delete canonical wallet file for replacement with autosave");
|
||||
if (temp.renameTo(canonical))
|
||||
return; // else fall through.
|
||||
|
Loading…
Reference in New Issue
Block a user