1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 04:07:46 +00:00
astra/launcher/src/utility.cpp

24 lines
777 B
C++
Raw Normal View History

2023-08-19 07:53:29 -04:00
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#include "utility.h"
#include <QStandardPaths>
QDir Utility::stateDirectory()
{
if (qEnvironmentVariableIsSet("XDG_STATE_HOME")) {
return qEnvironmentVariable("XDG_STATE_HOME");
}
const QDir homeDir = QStandardPaths::standardLocations(QStandardPaths::HomeLocation)[0];
2023-09-17 08:56:35 -04:00
const QDir localDir = homeDir.absoluteFilePath(QStringLiteral(".local"));
const QDir stateDir = localDir.absoluteFilePath(QStringLiteral("state"));
return stateDir.absoluteFilePath(QStringLiteral("astra"));
}
QString Utility::toWindowsPath(const QDir &dir)
{
2023-09-17 08:56:35 -04:00
return QStringLiteral("Z:") + dir.absolutePath().replace(QLatin1Char('/'), QLatin1Char('\\'));
}