mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-05 21:14:20 -04:00
Prevent overwriting of portable config on update
* Move portable configuration files into a config subfolder from the executable. This prevents overwriting the stored config when the application is updated in-place. * Use .portable file to signal a portable app * Fix #4751
This commit is contained in:
parent
9d10792640
commit
b7104be689
3 changed files with 7 additions and 15 deletions
|
@ -427,10 +427,10 @@ Config::Config(const QString& fileName, QObject* parent)
|
|||
Config::Config(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
// Check if portable config is present (use it also to store local config)
|
||||
QString portablePath = QDir::fromNativeSeparators(QCoreApplication::applicationDirPath()) + "/keepassxc.ini";
|
||||
if (QFile::exists(portablePath)) {
|
||||
init(portablePath);
|
||||
// Check if we are running in portable mode, if so store the config files local to the app
|
||||
auto portablePath = QCoreApplication::applicationDirPath().append("/%1");
|
||||
if (QFile::exists(portablePath.arg(".portable"))) {
|
||||
init(portablePath.arg("config/keepassxc.ini"), portablePath.arg("config/keepassxc_local.ini"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue