mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
revert to the previous cwd rather than assuming a particular path layout
This commit is contained in:
parent
63b5e862b3
commit
3dc9454cd7
1 changed files with 3 additions and 4 deletions
|
@ -23,6 +23,7 @@ class MediaManager(object):
|
|||
self._dir = re.sub("(?i)\.(anki2)$", ".media", self.col.path)
|
||||
if not os.path.exists(self._dir):
|
||||
os.makedirs(self._dir)
|
||||
self._oldcwd = os.getcwd()
|
||||
os.chdir(self._dir)
|
||||
# change database
|
||||
self.connect()
|
||||
|
@ -41,10 +42,8 @@ class MediaManager(object):
|
|||
return
|
||||
self.db.close()
|
||||
self.db = None
|
||||
# reset our path to ~/Anki
|
||||
anki_dir = os.path.dirname( os.path.dirname(self.col.path) )
|
||||
os.chdir(anki_dir)
|
||||
|
||||
# change cwd back to old location
|
||||
os.chdir(self._oldcwd)
|
||||
|
||||
def dir(self):
|
||||
return self._dir
|
||||
|
|
Loading…
Reference in a new issue