From 3114cf517d00b59b0664d510e73193ea220d681e Mon Sep 17 00:00:00 2001 From: Guy Scharf Date: Sun, 4 Apr 2021 04:56:39 -0700 Subject: [PATCH] Improve file identification in Icon loader Will no longer attempt to process SleepStyle data with Icon loader A new loader for SleepStyle machines is forthcoming. --- oscar/SleepLib/loader_plugins/icon_loader.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/oscar/SleepLib/loader_plugins/icon_loader.cpp b/oscar/SleepLib/loader_plugins/icon_loader.cpp index f2ad2963..097d1e85 100644 --- a/oscar/SleepLib/loader_plugins/icon_loader.cpp +++ b/oscar/SleepLib/loader_plugins/icon_loader.cpp @@ -66,6 +66,26 @@ bool FPIconLoader::Detect(const QString & givenpath) return false; } + // ICON serial numbers (directory names) are all digits (SleepStyle are mixed alpha and numeric) + QString serialDir(dir.path() + "/FPHCARE/ICON"); + QDir iconDir(serialDir); + + iconDir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks); + iconDir.setSorting(QDir::Name); + QFileInfoList flist = iconDir.entryInfoList(); + + bool ok; + + for (int i = 0; i < flist.size(); i++) { + QFileInfo fi = flist.at(i); + QString filename = fi.fileName(); + + filename.toInt(&ok); + + if (!ok) { + return false; + } + } return true; }