don't attempt to rename profile folder if it's a file

This commit is contained in:
Damien Elmes 2018-07-11 15:23:24 +10:00
parent 5d80dccccb
commit 3ff504461d

View file

@ -105,7 +105,7 @@ a flash drive.""" % self.base)
return os.path.join(loc, "Anki") return os.path.join(loc, "Anki")
else: else:
p = os.path.expanduser("~/Anki") p = os.path.expanduser("~/Anki")
if os.path.exists(p): if os.path.isdir(p):
return p return p
else: else:
loc = QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation) loc = QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation)
@ -121,7 +121,7 @@ a flash drive.""" % self.base)
def maybeMigrateFolder(self): def maybeMigrateFolder(self):
oldBase = self._oldFolderLocation() oldBase = self._oldFolderLocation()
if not os.path.exists(self.base) and os.path.exists(oldBase): if not os.path.exists(self.base) and os.path.isdir(oldBase):
shutil.move(oldBase, self.base) shutil.move(oldBase, self.base)
# Profile load/save # Profile load/save