Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wizardWalletInput: check wallet exists / pick correct default name #4116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions js/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,17 @@ function walletPathExists(accountsDir, directory, filename, isIOS, walletManager
var path = accountsDir + filename;
else
var path = directory + filename + "/" + filename;
var path2 = directory + filename;

if (walletManager.walletExists(path))
if (walletManager.walletExists(path) || walletManager.walletExists(path2))
return true;
return false;
}

function unusedWalletName(directory, filename, walletManager) {
function unusedWalletName(directory, filename, isIOS, walletManager) {
for (var i = 0; i < 100; i++) {
var walletName = filename + (i > 0 ? "_" + i : "");
if (!walletManager.walletExists(directory + "/" + walletName + "/" + walletName)) {
if (!walletPathExists(directory, directory, walletName, isIOS, walletManager)) {
return walletName;
}
}
Expand Down
2 changes: 1 addition & 1 deletion wizard/WizardWalletInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ GridLayout {
walletName.error = !walletName.verify();
walletLocation.error = !walletLocation.verify();
walletLocation.text = appWindow.accountsDir;
walletName.text = Wizard.unusedWalletName(appWindow.accountsDir, defaultAccountName, walletManager);
walletName.text = Wizard.unusedWalletName(appWindow.accountsDir, defaultAccountName, isIOS, walletManager);
}

MoneroComponents.LineEdit {
Expand Down