Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F325894
kazv-path-config.hpp.in
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
kazv-path-config.hpp.in
View Options
/*
* Copyright (C) 2021 Tusooa Zhu <tusooa@kazv.moe>
*
* This file is part of kazv.
*
* kazv is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* kazv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with kazv. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <libkazv-config.hpp>
#include <QString>
#include <QCoreApplication>
#include <QStandardPaths>
#include <QDir>
#include <filesystem>
namespace KazvPathConfigDetail
{
inline QString dirName(QString dir)
{
QDir d(dir);
d.cdUp();
return d.absolutePath();
}
inline QString pathJoin(QString dir, QString file)
{
using StdPath = std::filesystem::path;
return QString::fromStdString((StdPath(dir.toStdString()) / StdPath(file.toStdString())).string());
}
}
inline QString appDir()
{
static QString dir = QCoreApplication::applicationDirPath();
return dir;
}
inline QString installPrefixDir()
{
static QString dir = KazvPathConfigDetail::dirName(appDir());
return dir;
}
inline QString kazvDataDir()
{
static QString dir = KazvPathConfigDetail::pathJoin(installPrefixDir(), QString(R"xxx(${KAZV_DATA_DIR})xxx"));
return dir;
}
inline QString kazvL10nDir()
{
static QString dir = KazvPathConfigDetail::pathJoin(installPrefixDir(), QString(R"xxx(${KAZV_L10N_DIR})xxx"));
return dir;
}
inline QString kazvUserDataDir()
{
static QString dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
return dir;
}
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Thu, Apr 24, 4:27 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
86618
Default Alt Text
kazv-path-config.hpp.in (1 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment