Changeset 65e10ad


Ignore:
Timestamp:
03/05/14 09:17:14 (8 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
0debaa77
Parents:
109c737
Message:

Fix a bug in the Life-preserver GUI where if the parent/containing directory for a reversion is missing it would fail. Now it will automatically re-create the parent directory heirarchy as necessary when doing a restore.

Location:
src-qt4/life-preserver/lp-gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/lp-gui/LPGUtils.cpp

    r109c737 r65e10ad  
    165165  if( !nDir.exists() ){ 
    166166    //Create the new Directory 
     167    qDebug() << "Re-Create parent directory structure:" << newPath; 
    167168    nDir.cdUp(); 
    168     ok = nDir.mkdir(newPath.section("/",-1)); 
     169    ok = nDir.mkpath(newPath.section("/",-1)); //also create all parent directories if necessary 
    169170    if(ok){  
     171      qDebug() << " - Reset permissions on the main parent dir to match snapshot"; 
    170172      nDir.cd(newPath.section("/",-1));  
    171173      QFile::setPermissions(newPath, QFile::permissions(oldPath)); //make sure the new dir has the old permissions 
  • src-qt4/life-preserver/lp-gui/LPMain.cpp

    r109c737 r65e10ad  
    344344  QString filePath = fsModel->filePath( ui->treeView->currentIndex() ); 
    345345  qDebug() << " Restore file(s):" << filePath; 
    346   QString destDir = filePath.remove("/.zfs/snapshot/"+ui->label_snapshot->text()); 
     346  QFileInfo info(filePath);      
     347  QString destDir = filePath; 
     348        destDir.remove("/.zfs/snapshot/"+ui->label_snapshot->text()); 
    347349        destDir.chop( filePath.section("/",-1).size()+1 ); //get rid of the filename at the end 
    348350        while(!QFile::exists(destDir)){ destDir.chop( destDir.section("/",-1).size() +1); } 
     
    351353  //Perform the reversion(s) 
    352354  QStringList errors; 
    353   if(QFileInfo(filePath).isDir()){ 
     355  if( info.isDir() ){ 
    354356    //Is a directory 
    355357    showWaitBox( QString(tr("Restoring Directory: %1")).arg(newFilePath) ); 
Note: See TracChangeset for help on using the changeset viewer.