LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
paths.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <functional>
12#include <QStringList>
13#include <QFileInfo>
14#include "sysconfig.h"
15
16class QDir;
17class QUrl;
18
19namespace LC::Util
20{
25 enum class SysPath
26 {
33
40 };
41
68 UTIL_SYS_API QStringList GetPathCandidates (SysPath path, QString subfolder);
69
98 UTIL_SYS_API QString GetSysPath (SysPath path, const QString& subfolder, const QString& filename);
99
115 UTIL_SYS_API QUrl GetSysPathUrl (SysPath path, const QString& subfolder, const QString& filename);
116
126 UTIL_SYS_API QStringList GetSystemPaths ();
127
142 UTIL_SYS_API QString FindInSystemPath (const QString& name, const QStringList& paths,
143 const std::function<bool (QFileInfo)>& filter = {});
144
147 enum class UserDir
148 {
152
156 };
157
158 UTIL_SYS_API QDir GetUserDir (UserDir dir, const QString& subpath);
159
171 UTIL_SYS_API QDir CreateIfNotExists (QString path);
172
181 UTIL_SYS_API QString GetTemporaryName (const QString& pattern = {});
182
186 {
189 quint64 Capacity_;
190
195 quint64 Free_;
196
202 quint64 Available_;
203 };
204
213 UTIL_SYS_API SpaceInfo GetSpaceInfo (const QString& path);
214}
QString GetSysPath(SysPath path, const QString &suffix, const QString &filename)
Returns path to the file in the given root path and subfolder.
Definition paths.cpp:56
QStringList GetSystemPaths()
Returns the components of the system PATH variable.
Definition paths.cpp:74
QString GetTemporaryName(const QString &pattern)
Returns a temporary filename.
Definition paths.cpp:143
QString FindInSystemPath(const QString &name, const QStringList &paths, const std::function< bool(QFileInfo)> &filter)
Searches for a file in system paths according to a filter.
Definition paths.cpp:79
UserDir
Describes various user-specific paths.
Definition paths.h:148
@ Cache
Cache for volatile data.
Definition paths.h:151
QStringList GetPathCandidates(SysPath path, QString suffix)
Returns possible full paths for the path and subfolder.
Definition paths.cpp:24
QDir GetUserDir(UserDir dir, const QString &subpath)
Definition paths.cpp:97
QUrl GetSysPathUrl(SysPath path, const QString &subfolder, const QString &filename)
Returns path to the file in the given root path and subfolder.
Definition paths.cpp:69
SysPath
Describes various root paths recognized by GetSysPath().
Definition paths.h:26
@ Share
Directory with shared data files.
Definition paths.h:39
@ QML
Root path for QML files.
Definition paths.h:32
SpaceInfo GetSpaceInfo(const QString &path)
Returns the disk space info of the partition containing path.
Definition paths.cpp:154
QDir CreateIfNotExists(QString path)
Creates a path if it doesn't exist.
Definition paths.cpp:126
Definition constants.h:15
Contains information about a partition's disk space.
Definition paths.h:186
quint64 Free_
How much free space there is.
Definition paths.h:195
quint64 Capacity_
The capacity of the partition.
Definition paths.h:189
quint64 Available_
How much space is available to the current user.
Definition paths.h:202
#define UTIL_SYS_API
Definition sysconfig.h:16