DtkCore
DTK Core module
dstandardpaths.h
1// SPDX-FileCopyrightText: 2017 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DTK_CORE_FILESYSTEM_DSTANDARDPATHS_H
6#define DTK_CORE_FILESYSTEM_DSTANDARDPATHS_H
7
8#include <QStandardPaths>
9
10#include "dtkcore_global.h"
11
12DCORE_BEGIN_NAMESPACE
13
14class DStandardPathsPrivate;
15class LIBDTKCORESHARED_EXPORT DStandardPaths
16{
17public:
18 enum Mode {
19 Auto,
20 Snap,
21 Test,
22 };
23
24 static QString writableLocation(QStandardPaths::StandardLocation type);
25 static QStringList standardLocations(QStandardPaths::StandardLocation type);
26
27 static QString locate(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options = QStandardPaths::LocateFile);
28 static QStringList locateAll(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options = QStandardPaths::LocateFile);
29 static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList());
30 static void setMode(Mode mode);
31
32 enum class XDG {
33 DataHome,
34 ConfigHome,
35 CacheHome,
36 RuntimeTime
37 };
38
39 enum class DSG {
40 AppData,
41 DataDir
42 };
43
44 static QString homePath();
45 static QString homePath(const uint uid);
46 static QString path(XDG type);
47 static QString path(DSG type);
48 static QStringList paths(DSG type);
49 static QString filePath(XDG type, QString fileName);
50 static QString filePath(DSG type, QString fileName);
51
52private:
55 Q_DISABLE_COPY(DStandardPaths)
56};
57
58DCORE_END_NAMESPACE
59
60#endif // DTK_CORE_FILESYSTEM_DSTANDARDPATHS_H
Definition: dstandardpaths.h:16