Always creaste Backup/DATALOG folder before ScanFiles

This commit is contained in:
Phil Olynyk 2020-05-04 19:59:59 -04:00
parent cfe69ea7a0
commit 1b453e2fa5

View File

@ -284,14 +284,17 @@ int ResmedLoader::Open(const QString & dirpath)
// Check DATALOG folder exists and is readable
if (!QDir().exists(datalogPath)) {
qDebug() << "Missing DATALOG in" << dirpath;
return -1;
}
m_abort = false;
MachineInfo info = newInfo();
if ( ! parseIdentTGT(path, & info, idmap) )
if ( ! parseIdentTGT(path, & info, idmap) ) {
qDebug() << "Failed to parse Identification.tgt";
return -1;
}
qDebug() << "Info:" << info.series << info.model << info.modelnumber << info.serial;
#ifdef IDENT_DEBUG
@ -303,7 +306,7 @@ int ResmedLoader::Open(const QString & dirpath)
// Abort if no serial number
if (info.serial.isEmpty()) {
qDebug() << "ResMed Data card has no valid serial number in Indentification.tgt";
qDebug() << "ResMed Data card is missing serial number in Indentification.tgt";
return -1;
}
@ -383,6 +386,10 @@ int ResmedLoader::Open(const QString & dirpath)
if ( ! dir.exists(strBackupPath))
dir.mkpath(strBackupPath);
QString newpath = backup_path + "DATALOG";
if ( ! dir.exists(newpath) )
dir.mkpath(newpath);
if ( ! importing_backups ) {
BackupSTRfiles( strpath, path, strBackupPath, info, STRmap );
} else { // get the STR file that is in the BACKUP folder
@ -888,8 +895,9 @@ QString ResmedLoader::Backup(const QString & fullname, const QString & backup_pa
return "";
}
QString newpath = backup_path + RMS9_STR_datalog + "/" + yearstr;
!dir.exists(newpath) && dir.mkpath(newpath);
QString newpath = backup_path + "DATALOG" + "/" + yearstr;
if ( ! dir.exists(newpath) )
dir.mkpath(newpath);
newname = newpath+"/"+filename;