From b3f16c60ff9709ea0824ec9ad7dac4bcc904b849 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 30 Jan 2010 02:48:59 +0900 Subject: [PATCH] add 'anki' to documentDir --- ankiqt/ui/main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 2a52309c5..72bbfc0da 100755 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -2832,12 +2832,18 @@ Consider backing up your media directory first.""")) s = QSettings(QSettings.UserScope, "Microsoft", "Windows") s.beginGroup("CurrentVersion/Explorer/Shell Folders") self.documentDir = unicode(s.value("Personal").toString()) - if not os.path.exists(self.documentDir): - self.documentDir = os.path.expanduser("~/.anki") + if os.path.exists(self.documentDir): + self.documentDir = os.path.join(self.documentDir, "Anki") + else: + self.documentDir = os.path.expanduser("~/.anki/decks") elif sys.platform.startswith("darwin"): - self.documentDir = os.path.expanduser("~/Documents") + self.documentDir = os.path.expanduser("~/Documents/Anki") else: - self.documentDir = os.path.expanduser("~/.anki") + self.documentDir = os.path.expanduser("~/.anki/decks") + try: + os.mkdir(self.documentDir) + except (OSError, IOError): + pass def changeLayoutSpacing(self): if sys.platform.startswith("darwin"):