mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 19:50:45 +00:00
Make search for PRS1 "P-Series" folder truly case-insensitive.
This commit is contained in:
parent
c8520c8449
commit
485be366aa
@ -470,18 +470,31 @@ QString PRS1Loader::checkDir(const QString & path)
|
|||||||
return machpath;
|
return machpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString PRS1Loader::GetPSeriesPath(const QString & path)
|
||||||
|
{
|
||||||
|
QString outpath = "";
|
||||||
|
QDir root(path);
|
||||||
|
QStringList dirs = root.entryList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks);
|
||||||
|
for (auto & dir : dirs) {
|
||||||
|
// We've seen P-Series, P-SERIES, and p-series, so we need to search for the directory
|
||||||
|
// in a way that won't break on a case-sensitive filesystem.
|
||||||
|
if (dir.toUpper() == "P-SERIES") {
|
||||||
|
outpath = path + QDir::separator() + dir;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return outpath;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList PRS1Loader::FindMachinesOnCard(const QString & cardPath)
|
QStringList PRS1Loader::FindMachinesOnCard(const QString & cardPath)
|
||||||
{
|
{
|
||||||
QStringList machinePaths;
|
QStringList machinePaths;
|
||||||
|
|
||||||
|
QString pseriesPath = this->GetPSeriesPath(cardPath);
|
||||||
|
QDir pseries(pseriesPath);
|
||||||
|
|
||||||
// If it contains a P-Series folder, it's a PRS1 SD card
|
// If it contains a P-Series folder, it's a PRS1 SD card
|
||||||
QDir pseries(cardPath + QDir::separator() + "P-Series");
|
if (!pseriesPath.isEmpty() && pseries.exists()) {
|
||||||
if (!pseries.exists()) {
|
|
||||||
// Check for the all-caps version in case this is on a case-sensitive filesystem.
|
|
||||||
pseries = QDir(cardPath + QDir::separator() + "P-SERIES");
|
|
||||||
}
|
|
||||||
if (pseries.exists()) {
|
|
||||||
pseries.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks);
|
pseries.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks);
|
||||||
pseries.setSorting(QDir::Name);
|
pseries.setSorting(QDir::Name);
|
||||||
QFileInfoList plist = pseries.entryInfoList();
|
QFileInfoList plist = pseries.entryInfoList();
|
||||||
|
@ -444,6 +444,9 @@ class PRS1Loader : public CPAPLoader
|
|||||||
QString last;
|
QString last;
|
||||||
QHash<QString, Machine *> PRS1List;
|
QHash<QString, Machine *> PRS1List;
|
||||||
|
|
||||||
|
//! \brief Returns the path of the P-Series folder (whatever case) if present on the card
|
||||||
|
QString GetPSeriesPath(const QString & path);
|
||||||
|
|
||||||
//! \brief Returns the path for each machine detected on an SD card, from oldest to newest
|
//! \brief Returns the path for each machine detected on an SD card, from oldest to newest
|
||||||
QStringList FindMachinesOnCard(const QString & cardPath);
|
QStringList FindMachinesOnCard(const QString & cardPath);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user