-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Improve Portability Check #10760
Improve Portability Check #10760
Conversation
// If portable settings file exists save the JSON scripts to the application folder | ||
if (QFile::exists(QCoreApplication::applicationDirPath() + QStringLiteral("/keepassxc.ini"))) { | ||
if (QFile::exists(QCoreApplication::applicationDirPath() + QStringLiteral("/.portable"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be best to move this to an isPortable()
function, especially if that check is done in more than one place.
Also, the comment still says "portable settings file". Should probably say "portable marker", or just "In portable mode".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turn this into a function of Config: https://github.com/keepassxreboot/keepassxc/blob/develop/src%2Fcore%2FConfig.cpp#L522
Then use it there and here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would do that, but for that I am not versed enough in cpp to safely and securely code it. I don't even a way to compile keepassxc (or any cpp project), so testing is also out of the window.
Throw me a base C-Project (or Java, or PHP) and I could do more, but for cpp I am unfortunately only able to do small fixes like this, which don't really change the structure of the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to point out that changing the behaviour of this code may result in unexpected failures for people who rely on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would do that, but for that I am not versed enough in cpp to safely and securely code it. I don't even a way to compile keepassxc (or any cpp project), so testing is also out of the window. Throw me a base C-Project (or Java, or PHP) and I could do more, but for cpp I am unfortunately only able to do small fixes like this, which don't really change the structure of the code
I attempted it in a local repository, but:
- Config:
portablePath
would need to become a member-attribute or methodgetDefaultConfigs()
would need an additional parameter, or we would duplicate code, leaving us open for something similar to happen in the future - Config: alternatively: set
m_isPortable
(fromisPortable
) insidegetDefaultConfigs()
, but having to call the function in the parameterized Constructor aswell, even tough it serves no other purpose - Config: can't put it into
init
, as it is called aftergetDefaultConfigs()
, which requires said configs.
I am absolutely not comfortable in making that change myself.
I pushed how I would solve #10760 (comment) and apprently I am mixing static and non static fields. |
I fixed everything |
Screenshots
Fixes #10755
The check checked against keepassxc.ini being in the application directory, while the .portable file was actually being responsible for determining if the application was installed in portable mode.
In addition this fixes KeePassXCPortable on portableapps.com, as the check returned "not-portable" there, when it should have responsed "portable".
Testing strategy
No Test was conducted as it was only a filename change.
Type of change