1
0
mirror of https://gitlab.com/pholy/OSCAR-code.git synced 2025-04-13 17:20:51 +00:00

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