From 0afce5f19a09ea159167b6d9d83789a1d6bd88e3 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 17 May 2013 14:12:59 +0900 Subject: [PATCH] support unc pathnames again Turns out that WebKit does support UNC pathnames in the base tag, but it is picky about the leading number of slashes. --- aqt/profiles.py | 10 ---------- aqt/utils.py | 3 ++- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/aqt/profiles.py b/aqt/profiles.py index 365bc8f8f..9f6add370 100644 --- a/aqt/profiles.py +++ b/aqt/profiles.py @@ -61,7 +61,6 @@ class ProfileManager(object): self.base = os.path.abspath(base) else: self.base = self._defaultBase() - self.ensureLocalFS() self.ensureBaseExists() # load metadata self.firstRun = self._loadMeta() @@ -75,15 +74,6 @@ class ProfileManager(object): # Base creation ###################################################################### - def ensureLocalFS(self): - if self.base.startswith("\\\\"): - QMessageBox.critical( - None, "Error", """\ -To use Anki on a network share, the share must be mapped to a local drive \ -letter. Please see the 'File Locations' section of the manual for more \ -information.""") - raise Exception("unc") - def ensureBaseExists(self): try: self._ensureExists(self.base) diff --git a/aqt/utils.py b/aqt/utils.py index 95995e41d..2868440c8 100644 --- a/aqt/utils.py +++ b/aqt/utils.py @@ -330,10 +330,11 @@ def applyStyles(widget): def getBase(col): base = None mdir = col.media.dir() - if isWin: + if isWin and not mdir.startswith("\\\\"): prefix = u"file:///" else: prefix = u"file://" + mdir = mdir.replace("\\", "/") base = prefix + unicode( urllib.quote(mdir.encode("utf-8")), "utf-8") + "/"