mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-16 18:50:46 +00:00
Make CreateMachine searchf for lost machine folders
This commit is contained in:
parent
b6f13ae0d6
commit
cb051e28f2
@ -103,6 +103,19 @@ Machine * MachineLoader::CreateMachine(MachineInfo info, MachineID id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Before we create, find any lost folder to get the old ID
|
||||||
|
if ((id == 0) && ((info.type == MT_OXIMETER) || (info.type == MT_JOURNAL) || (info.type == MT_POSITION)|| (info.type == MT_SLEEPSTAGE))) {
|
||||||
|
QString dataPath = p_profile->Get("{" + STR_GEN_DataFolder + "}/");
|
||||||
|
QDir dir(dataPath);
|
||||||
|
QStringList namefilter(QString(info.loadername+"_*"));
|
||||||
|
QStringList files = dir.entryList(namefilter, QDir::Dirs);
|
||||||
|
if (files.size() > 0) {
|
||||||
|
QString idstr = files[0].section("_",-1);
|
||||||
|
bool ok;
|
||||||
|
id = idstr.toInt(&ok, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (info.type) {
|
switch (info.type) {
|
||||||
case MT_CPAP:
|
case MT_CPAP:
|
||||||
m = new CPAP(id);
|
m = new CPAP(id);
|
||||||
|
Loading…
Reference in New Issue
Block a user