aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorplowsof <plowsof@protonmail.com>2026-06-25 13:14:09 +0100
committerplowsof <plowsof@protonmail.com>2026-06-25 17:03:55 +0100
commit123433dd2caf7f5899c760e172dffb68df3375a7 (patch)
tree28a269cb1d999e21142348aa9ec036a1720fbe96
parent0e78e60cd799aaa207125c0c51278f0d481e9dea (diff)
downloadmonzero-gui-123433dd2caf7f5899c760e172dffb68df3375a7.tar.gz
monzero-gui-123433dd2caf7f5899c760e172dffb68df3375a7.tar.xz
monzero-gui-123433dd2caf7f5899c760e172dffb68df3375a7.zip
wizard: check wallet file directory is writeable
-rw-r--r--src/main/oshelper.cpp6
-rw-r--r--src/main/oshelper.h1
-rw-r--r--wizard/WizardWalletInput.qml4
3 files changed, 11 insertions, 0 deletions
diff --git a/src/main/oshelper.cpp b/src/main/oshelper.cpp
index 2ca0e400..cb9aca7a 100644
--- a/src/main/oshelper.cpp
+++ b/src/main/oshelper.cpp
@@ -248,6 +248,12 @@ QString OSHelper::temporaryPath() const
return QDir::tempPath();
}
+bool OSHelper::isWritableDirectory(const QString &path) const
+{
+ const QFileInfo info(path);
+ return info.exists() && info.isDir() && info.isWritable();
+}
+
QString OSHelper::randomPassword(int numBytes) const
{
numBytes = qBound(16, numBytes, 128);
diff --git a/src/main/oshelper.h b/src/main/oshelper.h
index 1c3aeb72..b6e98d32 100644
--- a/src/main/oshelper.h
+++ b/src/main/oshelper.h
@@ -51,6 +51,7 @@ public:
Q_INVOKABLE QString openSaveFileDialog(const QString &title, const QString &folder, const QString &filename) const;
Q_INVOKABLE QString temporaryFilename() const;
Q_INVOKABLE QString temporaryPath() const;
+ Q_INVOKABLE bool isWritableDirectory(const QString &path) const;
Q_INVOKABLE QString randomPassword(int numBytes = 32) const;
Q_INVOKABLE bool removeTemporaryWallet(const QString &walletName) const;
Q_INVOKABLE bool isCapsLock() const;
diff --git a/wizard/WizardWalletInput.qml b/wizard/WizardWalletInput.qml
index 882145ab..2c12d5c3 100644
--- a/wizard/WizardWalletInput.qml
+++ b/wizard/WizardWalletInput.qml
@@ -154,6 +154,10 @@ GridLayout {
errorMessageWalletLocation.text = qsTr("Wallet location is empty") + translationManager.emptyString;
return false;
}
+ if (!oshelper.isWritableDirectory(walletLocation.text)) {
+ errorMessageWalletLocation.text = qsTr("Wallet location does not exist or is not writable") + translationManager.emptyString;
+ return false;
+ }
errorMessageWalletLocation.text = "";
return true;
}