mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Add static methods to get the data paths in a library
This commit is contained in:
parent
af1af3976d
commit
c148a96d7f
@ -228,7 +228,7 @@ QString YACReaderLibrary::getPath() const
|
||||
|
||||
QString YACReaderLibrary::getDBPath() const
|
||||
{
|
||||
return path + "/.yacreaderlibrary";
|
||||
return YACReaderLibrary::libraryDataPath(path);
|
||||
}
|
||||
|
||||
int YACReaderLibrary::getLegacyId() const
|
||||
@ -251,6 +251,21 @@ bool YACReaderLibrary::operator!=(const YACReaderLibrary &other) const
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
QString YACReaderLibrary::libraryDataPath(const QString &libraryPath)
|
||||
{
|
||||
return QDir(libraryPath).filePath(".yacreaderlibrary");
|
||||
}
|
||||
|
||||
QString YACReaderLibrary::libraryDatabasePath(const QString &libraryPath)
|
||||
{
|
||||
return QDir(YACReaderLibrary::libraryDataPath(libraryPath)).filePath("library.ydb");
|
||||
}
|
||||
|
||||
QString YACReaderLibrary::libraryCoversFolderPath(const QString &libraryPath)
|
||||
{
|
||||
return QDir(YACReaderLibrary::libraryDataPath(libraryPath)).filePath("covers");
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const YACReaderLibrary &library)
|
||||
{
|
||||
out << library.name << library.path << library.legacyId << library.id;
|
||||
|
@ -55,6 +55,10 @@ public:
|
||||
friend QDataStream &operator>>(QDataStream &in, YACReaderLibrary &library);
|
||||
operator QString() const { return QString("%1 [%2, %3, %4]").arg(name, QString::number(legacyId), id.toString(QUuid::WithoutBraces), path); }
|
||||
|
||||
static QString libraryDataPath(const QString &libraryPath); // libraryPath + /.yacreaderlibrary
|
||||
static QString libraryDatabasePath(const QString &libraryPath); // libraryPath + /.yacreaderlibrary/library.ydb
|
||||
static QString libraryCoversFolderPath(const QString &libraryPath); // libraryPath + /.yacreaderlibrary/covers
|
||||
|
||||
private:
|
||||
QString name;
|
||||
QString path;
|
||||
|
Loading…
Reference in New Issue
Block a user