diff --git a/QtProject/app/db.cpp b/QtProject/app/db.cpp index 517b0599..a57cca03 100644 --- a/QtProject/app/db.cpp +++ b/QtProject/app/db.cpp @@ -20,11 +20,15 @@ bool Db::initDbAndCacheLocation(Prefs &prefs){ return true; } - //attempt with system application local cache folder (doesn't seem to work on windows in dev mode - QDir cacheFolder = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); - QString dbfilename = QStringLiteral("%1/cache.db").arg(cacheFolder.path()); + //attempt with system application local data folder (works better with UWP apps) + QDir cacheFolder = QDir(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); + QString dbfilename = QStringLiteral("%1/cache/cache.db").arg(cacheFolder.path()); if(!cacheFolder.exists()) QDir().mkpath(cacheFolder.path()); + // Ensure cache subdirectory exists + QDir cacheSubFolder = QDir(QStringLiteral("%1/cache").arg(cacheFolder.path())); + if(!cacheSubFolder.exists()) + QDir().mkpath(cacheSubFolder.path()); prefs.cacheFilePathName(dbfilename); if(initDbAndCache(prefs)) return true; diff --git a/QtProject/app/main.cpp b/QtProject/app/main.cpp index 2f39a5b4..bd2f7986 100644 --- a/QtProject/app/main.cpp +++ b/QtProject/app/main.cpp @@ -6,6 +6,11 @@ int main(int argc, char *argv[]) qDebug() << "Program start by Théophane with path :" << QDir::currentPath(); QApplication a(argc, argv); + + // Set application properties for proper Qt StandardPaths resolution + a.setApplicationName("Video simili duplicate cleaner"); + a.setOrganizationName("5743TheophaneMayaud"); + MainWindow w; w.show(); return a.exec();