Пример #1
0
void LibraryBaseElement::saveTo(const FilePath& parentDir) const throw (Exception)
{
    QString dirname = QString("%1.%2").arg(mUuid.toString()).arg(mXmlFileNamePrefix);
    mDirectory = parentDir.getPathTo(dirname);
    QString filename = QString("v%1/%2.xml").arg(APP_VERSION_MAJOR).arg(mXmlFileNamePrefix);
    mXmlFilepath = mDirectory.getPathTo(filename);
    save();
}
Пример #2
0
bool LibraryBaseElement::isDirectoryValidElement(const FilePath& dir) noexcept
{
    // find the xml file with the highest file version number
    for (int version = APP_VERSION_MAJOR; version >= 0; version--)
    {
        QString filename = QString("v%1/%2.xml").arg(version).arg(dir.getSuffix());
        if (dir.getPathTo(filename).isExistingFile()) return true; // file found
    }

    return false;
}
Пример #3
0
void DirectoryLock::setDirToLock(const FilePath& dir) noexcept {
  Q_ASSERT(!mLockedByThisObject);
  mDirToLock    = dir;
  mLockFilePath = dir.getPathTo(".lock");
}