mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-17 17:34:50 -05:00
Handle tilde with custom paths
This commit is contained in:
parent
986fa42ca8
commit
250cd1933c
4 changed files with 40 additions and 12 deletions
|
|
@ -20,6 +20,7 @@
|
|||
#include "BrowserSettings.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/PasswordHealth.h"
|
||||
#include <QDir>
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
|
@ -516,3 +517,27 @@ void BrowserSettings::updateBinaryPaths()
|
|||
{
|
||||
m_nativeMessageInstaller.updateBinaryPaths();
|
||||
}
|
||||
|
||||
QString BrowserSettings::replaceHomePath(QString location)
|
||||
{
|
||||
#ifndef Q_OS_WIN
|
||||
auto homePath = QDir::homePath();
|
||||
if (location.startsWith(homePath)) {
|
||||
location.replace(homePath, "~");
|
||||
}
|
||||
#endif
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
QString BrowserSettings::replaceTildeHomePath(QString location)
|
||||
{
|
||||
#ifndef Q_OS_WIN
|
||||
auto homePath = QDir::homePath();
|
||||
if (location.startsWith("~")) {
|
||||
location.replace("~", homePath);
|
||||
}
|
||||
#endif
|
||||
|
||||
return location;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue