From c5e4708da7d7e31e814a3c5fcc600b055a413626 Mon Sep 17 00:00:00 2001 From: pawelsalawa Date: Sun, 1 Dec 2024 15:39:06 +0100 Subject: [PATCH] #5146 If user enters a relative file path to the database dialog, a warning will issued to the user pointing out actual resolved path for the relative path entered. --- ChangeLog.md | 1 + SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 8447df38e5..d36111d124 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,7 @@ # ChangeLog ### 3.4.8 +- CHANGE: #5146 If user enters a relative file path to the database dialog, a warning will issued to the user pointing out actual resolved path for the relative path entered. - BUGFIX: #5145 Fixed Extensions Manager crashing the app if the percentile extension was loaded before. The percentile SQLite extension became corrupted in SQLite 3.46.x, then it got fixed, but the fix is not included in SQLite 3.47.1 source package. - BUGFIX: #5144 Fixed Extensions Manager commit button when all extensions got removed from the list. diff --git a/SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp b/SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp index f9910e31cd..2b85be3f7f 100644 --- a/SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp @@ -575,6 +575,13 @@ bool DbDialog::validate() setValidState(ui->fileEdit, false, tr("Enter a database file path.")); fileState = false; } + else if (QFileInfo(getPath()).isRelative()) + { + setValidStateWarning(ui->fileEdit, + tr("You're using a relative file path, which will be resolved to \"%1\" according to the application's working directory. It's always better to use absolute file path to avoid unexpected database location.") + .arg(QFileInfo(getPath()).absoluteFilePath())); + fileState = false; + } if (fileState) {