Save relative paths in fastresume files

Conditionally change absolute paths to relative in the fastresume data files.
The condition is specified by user via a command line parameter and
paths are relative to the profile dir.

On Windows the convertion to relative path is performed if the path and
the profile are on the same drive only.
This commit is contained in:
Eugene Shalygin 2016-05-13 20:32:47 +02:00
commit a8d95dd8bd
9 changed files with 127 additions and 21 deletions

View file

@ -42,6 +42,7 @@ class Application;
namespace Private
{
class Profile;
class PathConverter;
}
using SettingsPtr = std::unique_ptr<QSettings>;
@ -64,17 +65,22 @@ public:
/// or the value, supplied via parameters
QString configurationName() const;
QString toPortablePath(const QString &absolutePath) const;
QString fromPortablePath(const QString &portablePath) const;
static const Profile &instance();
private:
Profile(Private::Profile *impl);
Profile(Private::Profile *impl, Private::PathConverter *pathConverter);
~Profile();
friend class ::Application;
static void initialize(const QString &rootProfilePath, const QString &configurationName);
static void initialize(const QString &rootProfilePath, const QString &configurationName,
bool convertPathsToProfileRelative);
void ensureDirectoryExists(SpecialFolder folder);
QScopedPointer<Private::Profile> m_impl;
QScopedPointer<Private::Profile> m_profileImpl;
QScopedPointer<Private::PathConverter> m_pathConverterImpl;
static Profile *m_instance;
};