2023-08-19 07:53:29 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-08-18 14:52:06 -04:00
|
|
|
#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('/', '\\');
|
|
|
|
}
|