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)
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)

View file

@ -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") + "/"