prevent wallet backup on windows due to file lock

This commit is contained in:
woodser 2025-02-21 18:27:48 -05:00
parent 8a01a07ac2
commit 40924a6f7b

View File

@ -247,7 +247,11 @@ public class XmrWalletService extends XmrWalletBase {
@Override @Override
public void saveWallet() { public void saveWallet() {
saveWallet(!(Utilities.isWindows() && wallet != null)); saveWallet(shouldBackup(wallet));
}
private boolean shouldBackup(MoneroWallet wallet) {
return wallet != null && !Utilities.isWindows(); // TODO: cannot backup on windows because file is locked
} }
public void saveWallet(boolean backup) { public void saveWallet(boolean backup) {
@ -389,7 +393,7 @@ public class XmrWalletService extends XmrWalletBase {
MoneroError err = null; MoneroError err = null;
String path = wallet.getPath(); String path = wallet.getPath();
try { try {
if (save) saveWallet(wallet, true); if (save) saveWallet(wallet, shouldBackup(wallet));
wallet.close(); wallet.close();
} catch (MoneroError e) { } catch (MoneroError e) {
err = e; err = e;