|
|
@@ -35,7 +35,7 @@ class FSObject(object): |
|
|
|
self.pstat = nstat |
|
|
|
self.doUpdate() |
|
|
|
except OSError, x: |
|
|
|
log.msg('OSError: %s' % x) |
|
|
|
log.msg('os.stat, OSError: %s' % x) |
|
|
|
if x.errno in (errno.ENOENT, errno.ENOTDIR, errno.EPERM, ): |
|
|
|
# We can't access it anymore, delete it |
|
|
|
self.cd.delItem(self.id) |
|
|
@@ -120,14 +120,12 @@ class FSDirectory(FSObject, StorageFolder): |
|
|
|
def doUpdate(self): |
|
|
|
# We need to rescan this dir, and see if our children has |
|
|
|
# changed any. |
|
|
|
log.msg('doUpdate: %s, path: %s' % (self.title, self.FSpath)) |
|
|
|
children = sets.Set(os.listdir(self.FSpath)) |
|
|
|
for i in self.pathObjmap: |
|
|
|
if i not in children: |
|
|
|
# delete |
|
|
|
self.cd.delItem(self.pathObjmap[i]) |
|
|
|
|
|
|
|
log.msg('doUpdate: %s, children: %s' % (self.title, children)) |
|
|
|
for i in children: |
|
|
|
fname = os.path.join(self.FSpath, i) |
|
|
|
if i in self.pathObjmap: |
|
|
@@ -146,11 +144,9 @@ class FSDirectory(FSObject, StorageFolder): |
|
|
|
|
|
|
|
if nf is not None: |
|
|
|
self.pathObjmap[i] = nf |
|
|
|
log.msg('i: %s, nf: %s' % (i, nf)) |
|
|
|
|
|
|
|
# sort our children |
|
|
|
log.msg('doUpdate: %s, sorting: %s' % (self.title, list.__str__(self))) |
|
|
|
self.sort(lambda x, y: cmp(x.title, y.title)) |
|
|
|
log.msg('sorted') |
|
|
|
|
|
|
|
# Pass up to handle UpdateID |
|
|
|
StorageFolder.doUpdate(self) |