aboutsummaryrefslogtreecommitdiff
path: root/lumina-fm
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-10-21 13:20:19 -0400
committerKen Moore <moorekou@gmail.com>2015-10-21 13:20:19 -0400
commitca1cb449731e5eb9d1cd92872950b997ef191b91 (patch)
tree4f9b243a25904ec692ba1730365e2c426caebcd6 /lumina-fm
parentUpdate the ItemWidgets in the start menu plugin to resize the icons/text as n... (diff)
downloadlumina-ca1cb449731e5eb9d1cd92872950b997ef191b91.tar.gz
lumina-ca1cb449731e5eb9d1cd92872950b997ef191b91.tar.bz2
lumina-ca1cb449731e5eb9d1cd92872950b997ef191b91.zip
Clean up the detection of ZFS snapshot availability a bit: This should fix issues with non-ZFS filesystems and directories which are symlinks to elsewhere.
Diffstat (limited to 'lumina-fm')
-rw-r--r--lumina-fm/DirData.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/lumina-fm/DirData.h b/lumina-fm/DirData.h
index e759a17a..c3ace5a4 100644
--- a/lumina-fm/DirData.h
+++ b/lumina-fm/DirData.h
@@ -155,23 +155,32 @@ public slots:
HASH[dirpath].findSnapDir();
}
//Now read off all the available snapshots
- if(HASH.value(dirpath).snapdir != "-"){
+ if(HASH.value(dirpath).snapdir != "-" && !HASH.value(dirpath).snapdir.isEmpty()){
//Good snapshot directory found - read off the current snapshots (can change regularly - don't cache this)
base = HASH.value(dirpath).snapdir;
QDir dir(base);
+ QString canon = QFileInfo(dirpath).canonicalFilePath();
+ QString dcanon = QString(dir.canonicalPath()+"/").section(ZSNAPDIR,0,0);
+ QString relpath = canon.section( dcanon+"/" ,-1);
+ //qDebug() << "Snapshot Dir:" << base << dcanon << "Dir:" << dirpath << canon << "Relpath:" << relpath;
snaps = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time |QDir::Reversed );
//Also remove any "empty" snapshots (might be leftover by tools like "zfsnap")
for(int i=0; i<snaps.length(); i++){
dir.cd(base+"/"+snaps[i]);
- //qDebug() << "Snapshot Dir Contents Count:" << dir.count() << snaps[i];
- if(dir.count() < 3 && dir.exists() ){ snaps.removeAt(i); i--; } // "." and ".." are always in the count
+ if(relpath.isEmpty()){
+ //Make sure the snapshot is not empty
+ if(dir.count() < 3 && dir.exists() ){ snaps.removeAt(i); i--; } // "." and ".." are always in the count
+ //Make sure the snapshot contains the directory we are looking for
+ }else if(!dir.exists(relpath)){ snaps.removeAt(i); i--; }
}
//NOTE: snaps are sorted oldest -> newest
}
}
//if(DIR_DEBUG){ qDebug() << " -- Snap Data Found:" << ID << base << snaps; }
- emit SnapshotDataAvailable(ID, base, snaps);
+ if(!base.isEmpty() && !snaps.isEmpty()){
+ emit SnapshotDataAvailable(ID, base, snaps);
+ }
}
};
bgstack15