mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-07 01:12:57 -05:00
fix: improve single instance detection for non-standard USER env var on Windows
This commit is contained in:
parent
8cfbe48f78
commit
8289793f95
1 changed files with 21 additions and 2 deletions
|
|
@ -75,8 +75,27 @@ Application::Application(int& argc, char** argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
userName.replace('/', '_');
|
||||
userName.replace('\\', '_');
|
||||
|
||||
static const QRegularExpression invalidFileChars(R"([<>:\"/\\|?*])");
|
||||
userName.replace(invalidFileChars, "_");
|
||||
|
||||
// Remove leading/trailing whitespace and trailing dots/spaces
|
||||
userName = userName.trimmed();
|
||||
while (!userName.isEmpty() && (userName.endsWith('.') || userName.endsWith(' '))) {
|
||||
userName.chop(1);
|
||||
}
|
||||
|
||||
// Build identifier for lock/socket file naming
|
||||
QString identifier = QStringLiteral("keepassxc");
|
||||
if (!userName.isEmpty()) {
|
||||
identifier += QChar('-') + userName;
|
||||
}
|
||||
#ifdef QT_DEBUG
|
||||
identifier += QStringLiteral("-DEBUG");
|
||||
#endif
|
||||
QString lockName = identifier + QStringLiteral(".lock");
|
||||
m_socketName = identifier + QStringLiteral(".socket");
|
||||
|
||||
QString identifier = "keepassxc";
|
||||
if (!userName.isEmpty()) {
|
||||
identifier += "-" + userName;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue