Implement class for handling filesystem paths

PR #15915.
This commit is contained in:
Vladimir Golovnev
2022-02-08 06:03:48 +03:00
committed by GitHub
parent facfa26eed
commit dd1bd8ad10
131 changed files with 2252 additions and 1868 deletions

View File

@@ -33,6 +33,8 @@
#include <QSettings>
#include "base/pathfwd.h"
class QString;
namespace Private
@@ -54,26 +56,26 @@ enum class SpecialFolder
class Profile
{
public:
static void initInstance(const QString &rootProfilePath, const QString &configurationName,
static void initInstance(const Path &rootProfilePath, const QString &configurationName,
bool convertPathsToProfileRelative);
static void freeInstance();
static const Profile *instance();
QString location(SpecialFolder folder) const;
Path location(SpecialFolder folder) const;
SettingsPtr applicationSettings(const QString &name) const;
QString rootPath() const;
Path rootPath() const;
QString configurationName() const;
/// Returns either default name for configuration file (QCoreApplication::applicationName())
/// or the value, supplied via parameters
QString profileName() const;
QString toPortablePath(const QString &absolutePath) const;
QString fromPortablePath(const QString &portablePath) const;
Path toPortablePath(const Path &absolutePath) const;
Path fromPortablePath(const Path &portablePath) const;
private:
Profile(const QString &rootProfilePath, const QString &configurationName, bool convertPathsToProfileRelative);
Profile(const Path &rootProfilePath, const QString &configurationName, bool convertPathsToProfileRelative);
~Profile() = default; // to generate correct call to ProfilePrivate::~ProfileImpl()
void ensureDirectoryExists(SpecialFolder folder) const;
@@ -83,4 +85,4 @@ private:
static Profile *m_instance;
};
QString specialFolderLocation(SpecialFolder folder);
Path specialFolderLocation(SpecialFolder folder);