[app] Added missing BooksStorage::fullConfigPath implementation

This commit is contained in:
Slava Monich 2018-02-04 11:14:22 +03:00
parent 28a814dd26
commit bf38202e31

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2015-2017 Jolla Ltd. * Copyright (C) 2015-2018 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com> * Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
* *
* You may use this file under the terms of the BSD license as follows: * You may use this file under the terms of the BSD license as follows:
* *
@ -71,6 +71,7 @@ public:
bool isRemoved() const; bool isRemoved() const;
bool equal(const Private& aData) const; bool equal(const Private& aData) const;
static QString fullPath(QDir aDir, QString aRelativePath);
static QString mountPoint(QString aPath); static QString mountPoint(QString aPath);
static bool isMountPoint(QString aPath); static bool isMountPoint(QString aPath);
@ -149,6 +150,16 @@ QString BooksStorage::Private::mountPoint(QString aPath)
return dir.path(); return dir.path();
} }
QString BooksStorage::Private::fullPath(QDir aDir, QString aRelativePath)
{
QString path(aDir.path());
if (!aRelativePath.isEmpty()) {
if (!path.endsWith('/')) path += '/';
path += aRelativePath;
}
return QDir::cleanPath(path);
}
// ========================================================================== // ==========================================================================
// BooksStorage // BooksStorage
// ========================================================================== // ==========================================================================
@ -221,12 +232,15 @@ bool BooksStorage::isPresent() const
QString BooksStorage::fullPath(QString aRelativePath) const QString BooksStorage::fullPath(QString aRelativePath) const
{ {
if (iPrivate) { if (iPrivate) {
QString path(booksDir().path()); return Private::fullPath(iPrivate->iBooksDir, aRelativePath);
if (!aRelativePath.isEmpty()) { }
if (!path.endsWith('/')) path += '/'; return QString();
path += aRelativePath; }
}
return QDir::cleanPath(path); QString BooksStorage::fullConfigPath(QString aRelativePath) const
{
if (iPrivate) {
return Private::fullPath(iPrivate->iConfigDir, aRelativePath);
} }
return QString(); return QString();
} }