1 parent
41599fa82f
commit
0dd6bef715
12 files changed
+161
-64
No files matched your search
+20
-3
@@ -3,21 +3,38 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QtGlobal>
|
||||
|
||||
namespace {
|
||||
|
||||
const QString kFolderName = QStringLiteral("BiLauncher");
|
||||
|
||||
// Домашняя папка, от которой строятся все пути (см. LauncherPaths::homeOverride()).
|
||||
QString homeBase()
|
||||
{
|
||||
const QString overridden = LauncherPaths::homeOverride();
|
||||
return overridden.isEmpty() ? QDir::homePath() : overridden;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
QString LauncherPaths::homeOverride()
|
||||
{
|
||||
// Относительный путь зависел бы от текущей папки процесса — такой не принимаем.
|
||||
const QString value = QDir::fromNativeSeparators(qEnvironmentVariable("BILAUNCHER_HOME"));
|
||||
if (value.isEmpty() || !QDir::isAbsolutePath(value))
|
||||
return QString();
|
||||
return QDir::cleanPath(value);
|
||||
}
|
||||
|
||||
QString LauncherPaths::containerDir()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
return QDir::homePath() + QStringLiteral("/AppData/Roaming");
|
||||
return homeBase() + QStringLiteral("/AppData/Roaming");
|
||||
#elif defined(Q_OS_MACOS)
|
||||
return QDir::homePath() + QStringLiteral("/Library/Application Support");
|
||||
return homeBase() + QStringLiteral("/Library/Application Support");
|
||||
#else // Linux и прочие Unix-системы
|
||||
return QDir::homePath();
|
||||
return homeBase();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user