mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 12:17:45 +00:00
23 lines
687 B
C++
23 lines
687 B
C++
// 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];
|
|
const QDir localDir = homeDir.absoluteFilePath(".local");
|
|
const QDir stateDir = localDir.absoluteFilePath("state");
|
|
return stateDir.absoluteFilePath("astra");
|
|
}
|
|
|
|
QString Utility::toWindowsPath(const QDir &dir)
|
|
{
|
|
return "Z:" + dir.absolutePath().replace('/', '\\');
|
|
}
|