Added simple PRS1 SD card Backup functionality

This commit is contained in:
Mark Watkins 2014-07-03 02:55:38 +10:00
parent d16bc60f69
commit 3ed32ccad3
2 changed files with 29 additions and 1 deletions

View File

@ -356,6 +356,31 @@ bool PRS1Loader::ParseProperties(Machine *m, QString filename)
return true;
}
void copyPath(QString src, QString dst)
{
QDir dir(src);
if (!dir.exists())
return;
// Recursively handle directories
foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
QString dst_path = dst + QDir::separator() + d;
dir.mkpath(dst_path);
copyPath(src + QDir::separator() + d, dst_path);
}
// Files
foreach (QString f, dir.entryList(QDir::Files)) {
QString srcFile = src + QDir::separator() + f;
QString destFile = dst + QDir::separator() + f;
if (!QFile::exists(destFile)) {
QFile::copy(srcFile, destFile);
}
}
}
int PRS1Loader::OpenMachine(Machine *m, QString path, Profile *profile)
{
Q_UNUSED(profile)
@ -366,7 +391,8 @@ int PRS1Loader::OpenMachine(Machine *m, QString path, Profile *profile)
if (!dir.exists() || (!dir.isReadable())) {
return 0;
}
QString backupPath = p_profile->Get(m->properties[STR_PROP_BackupPath]) + path.section("/", -2);
copyPath(path, backupPath);
dir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Name);

View File

@ -9,6 +9,8 @@
<p>0.9.7 already? Yup.. otherwise I can't tell them apart, and you probably won't be able to either. Before anyone asks, yes, version numbers will go past 0.9.10 before 1.0.0 is reached.</p>
<p>Not a gigantic set of changes this time, but I've been busily working my way through a lot of bugs mentioned on the forums, trying to knock them down one by one. Please don't be offended if yours isn't in here yet.. I have a memory like a goldfish, plus I tried to focus on stability issues first.</p>
<p>A gentle reminder for anyone submitting bug reports (either via message or through sourceforges bug reporting system), please (please please) remember to state the SleepyHead version number, your computers platform and operating system type version (and service packs), and your CPAP machines type and model number. Without this information I pretty much don't have a clue what you are talking about.</p>
<p><b>Known Issues with this build</b></p>
There is still a problem with time splits for summary only..
<br/>
<b>New features & bug fixes in v0.9.7</b><br/>
<list>