forked from instead-hub/instead-launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
platform.cpp
58 lines (43 loc) · 1.48 KB
/
platform.cpp
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
#include "platform.h"
#include <QMessageBox>
bool checkOrCreateGameDir( QString gameDir ) {
QDir dir(gameDir);
if (dir.exists()) return true;
qWarning() << "mkpath " << gameDir;
return dir.mkpath(".");
}
#ifdef Q_OS_UNIX
QString getGameDirPath() {
return QDir::home().absolutePath() + "/.instead/games/";
}
QString getConfigPath() {
return QDir::home().absolutePath() + "/.instead/launcher.ini";
}
QString getDefaultInterpreterPath() {
return "/usr/local/bin/sdl-instead";
}
#elif defined(Q_OS_WIN)
QString getGameDirPath() {
QString currentPath = QDir::currentPath()+"/appdata";
if (QFileInfo(currentPath).exists()) {
return QDir::toNativeSeparators("appdata/games/");
}
return QDir::toNativeSeparators(QDir::home().absolutePath()) + "\\Local Settings\\Application Data\\instead\\games\\";
}
QString getConfigPath() {
QString currentPath = QDir::currentPath()+"/appdata";
if (QFileInfo(currentPath).exists()) {
return QDir::toNativeSeparators(currentPath + "/launcher.ini");
}
return QDir::toNativeSeparators(QDir::home().absolutePath()) + "\\Local Settings\\Application Data\\instead\\launcher.ini";
}
QString getDefaultInterpreterPath() {
QString currentPath = QDir::currentPath()+"/sdl-instead.exe";
if (QFileInfo(currentPath).exists()) {
return QDir::toNativeSeparators("sdl-instead.exe");
}
return "c:\\Program Files\\Games\\INSTEAD\\sdl-instead.exe";
}
#else
#error "Unsupported OS"
#endif