Permalink
Browse files

Make sure the destination directory exists, otherwise roll up the des…

…tination directory path one parent directory at a time until an existing directory is found. This does not affect the creation of directories during a restoration of a directory, just the initial destination directory for the restored file(s).
  • Loading branch information...
1 parent be06ac1 commit 140552dd6eaf845effdb6068c5f37b2138b2a18f Ken Moore committed Oct 14, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 lp-gui/LPMain.cpp
View
@@ -233,9 +233,10 @@ void LPMain::restoreFiles(){
QString filePath = fsModel->filePath( ui->treeView->currentIndex() );
qDebug() << " Restore file(s):" << filePath;
QString destDir = filePath.remove("/.zfs/snapshot/"+ui->label_snapshot->text());
- destDir.remove( "/"+filePath.section("/",-1) ); //get rid of the filename at the end
+ destDir.chop( filePath.section("/",-1).size()+1 ); //get rid of the filename at the end
+ while(!QFile::exists(destDir)){ destDir.chop( destDir.section("/",-1).size() +1); }
QString newFilePath = destDir+"/"+LPGUtils::generateReversionFileName(filePath, destDir);
-
+ //qDebug() << "Destination:" << newFilePath;
//Perform the reversion(s)
QStringList errors;
if(QFileInfo(filePath).isDir()){

0 comments on commit 140552d

Please sign in to comment.