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)
|
self._dir = re.sub("(?i)\.(anki2)$", ".media", self.col.path)
|
||||||
if not os.path.exists(self._dir):
|
if not os.path.exists(self._dir):
|
||||||
os.makedirs(self._dir)
|
os.makedirs(self._dir)
|
||||||
|
self._oldcwd = os.getcwd()
|
||||||
os.chdir(self._dir)
|
os.chdir(self._dir)
|
||||||
# change database
|
# change database
|
||||||
self.connect()
|
self.connect()
|
||||||
|
@ -41,10 +42,8 @@ class MediaManager(object):
|
||||||
return
|
return
|
||||||
self.db.close()
|
self.db.close()
|
||||||
self.db = None
|
self.db = None
|
||||||
# reset our path to ~/Anki
|
# change cwd back to old location
|
||||||
anki_dir = os.path.dirname( os.path.dirname(self.col.path) )
|
os.chdir(self._oldcwd)
|
||||||
os.chdir(anki_dir)
|
|
||||||
|
|
||||||
|
|
||||||
def dir(self):
|
def dir(self):
|
||||||
return self._dir
|
return self._dir
|
||||||
|
|
Loading…
Reference in a new issue