don't die if src collection is missing media folder

This commit is contained in:
Damien Elmes 2012-09-21 23:50:41 +09:00
parent e3da64f00b
commit 3f01b1ef59

View file

@ -271,7 +271,10 @@ insert or ignore into revlog values (?,?,?,?,?,?,?,?,?)""", revlog)
def _importStaticMedia(self): def _importStaticMedia(self):
# Import any '_foo' prefixed media files regardless of whether # Import any '_foo' prefixed media files regardless of whether
# they're used on notes or not # they're used on notes or not
for fname in os.listdir(self.src.media.dir()): dir = self.src.media.dir()
if not os.path.exists(dir):
return
for fname in os.listdir(dir):
if fname.startswith("_") and not self.dst.media.have(fname): if fname.startswith("_") and not self.dst.media.have(fname):
self._writeDstMedia(fname, self._srcMediaData(fname)) self._writeDstMedia(fname, self._srcMediaData(fname))