-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsystem.h
59 lines (51 loc) · 2.12 KB
/
system.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* Unvanquished Updater
* Copyright (C) Unvanquished Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SYSTEM_H_
#define SYSTEM_H_
#include <string>
#include <QSettings>
#include <QString>
namespace Sys {
QString archiveName();
QString defaultInstallPath();
void initApplicationName(); // influences default storage location for QSettings
bool validateInstallPath(const QString& installPath); // Checks installing as root in homepath on Linux
bool installShortcuts(); // Install launch menu entries and protocol handlers
bool installUpdater(const QString& installPath); // Copies current application to <install path>/updater[.exe|.app]
bool updateUpdater(const QString& updaterArchive, const QString& connectUrl);
QString updaterArchiveName();
std::string getCertStore();
QSettings* makePersistentSettings(QObject* parent);
QString getGameCommand(const QString& installPath); // Substitution for %command%
// A connect URL is already included in command line but on Windows if the updater has to restart to
// lose admin elevation, it uses connectUrlForRestart
QString startGame(const QString& commandLine, bool failIfWindowsAdmin, const QString& connectUrlForRestart);
// Windows: relaunch with UAC elevation if necessary
// Other platforms always return UNNEEDED
enum class ElevationResult {
UNNEEDED,
RELAUNCHED,
FAILED,
};
ElevationResult RelaunchElevated(const QString& flags);
inline QString QuoteQProcessCommandArgument(QString arg)
{
arg.replace('"', "\"\"\"");
return '"' + arg + '"';
}
}
#endif // SYSTEM_H_