mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Fix race condition allowing to run several instances of qBittorrent at the same time
This commit is contained in:
parent
7ab206ebac
commit
b9394f2ba2
24 changed files with 1713 additions and 156 deletions
18
src/misc.cpp
18
src/misc.cpp
|
@ -45,6 +45,11 @@
|
|||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <shlobj.h>
|
||||
#include <windows.h>
|
||||
const int UNLEN = 256;
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
|
@ -545,6 +550,19 @@ QString misc::userFriendlyDuration(qlonglong seconds) {
|
|||
return QString::fromUtf8("∞");
|
||||
}
|
||||
|
||||
QString misc::getUserIDString() {
|
||||
QString uid = "0";
|
||||
#ifdef Q_WS_WIN
|
||||
char buffer[UNLEN+1] = {0};
|
||||
DWORD buffer_len = UNLEN + 1;
|
||||
if (!GetUserNameA(buffer, &buffer_len))
|
||||
uid = QString(buffer);
|
||||
#else
|
||||
uid = QString::number(getuid());
|
||||
#endif
|
||||
return uid;
|
||||
}
|
||||
|
||||
QStringList misc::toStringList(const QList<bool> &l) {
|
||||
QStringList ret;
|
||||
foreach(const bool &b, l) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue