void tst_qqmlengine::offlineStoragePath() { // Without these set, QDesktopServices::storageLocation returns // strings with extra "//" at the end. We set them to ignore this problem. qApp->setApplicationName("tst_qqmlengine"); qApp->setOrganizationName("QtProject"); qApp->setOrganizationDomain("www.qt-project.org"); QQmlEngine engine; QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::DataLocation); QCOMPARE(dataLocation.isEmpty(), engine.offlineStoragePath().isEmpty()); QDir dir(dataLocation); dir.mkpath("QML"); dir.cd("QML"); dir.mkpath("OfflineStorage"); dir.cd("OfflineStorage"); QCOMPARE(QDir::fromNativeSeparators(engine.offlineStoragePath()), dir.path()); engine.setOfflineStoragePath(QDir::homePath()); QCOMPARE(engine.offlineStoragePath(), QDir::homePath()); }
QString Helpers::getOfflineStorageDir(void) { QQmlEngine engine; return engine.offlineStoragePath(); }