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.
This commit is contained in:
Damien Elmes 2013-05-17 14:12:59 +09:00
parent 273cb74e3d
commit 0afce5f19a
2 changed files with 2 additions and 11 deletions

View file

@ -61,7 +61,6 @@ class ProfileManager(object):
self.base = os.path.abspath(base) self.base = os.path.abspath(base)
else: else:
self.base = self._defaultBase() self.base = self._defaultBase()
self.ensureLocalFS()
self.ensureBaseExists() self.ensureBaseExists()
# load metadata # load metadata
self.firstRun = self._loadMeta() self.firstRun = self._loadMeta()
@ -75,15 +74,6 @@ class ProfileManager(object):
# Base creation # 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): def ensureBaseExists(self):
try: try:
self._ensureExists(self.base) self._ensureExists(self.base)

View file

@ -330,10 +330,11 @@ def applyStyles(widget):
def getBase(col): def getBase(col):
base = None base = None
mdir = col.media.dir() mdir = col.media.dir()
if isWin: if isWin and not mdir.startswith("\\\\"):
prefix = u"file:///" prefix = u"file:///"
else: else:
prefix = u"file://" prefix = u"file://"
mdir = mdir.replace("\\", "/")
base = prefix + unicode( base = prefix + unicode(
urllib.quote(mdir.encode("utf-8")), urllib.quote(mdir.encode("utf-8")),
"utf-8") + "/" "utf-8") + "/"