E-book viewer: Fix popup footnotes not working on windows

I forgot that QUrl.toLocalFile() uses the forward slash as the path
separator on windows.
This commit is contained in:
Kovid Goyal 2014-11-13 08:31:41 +05:30
parent c98eb806f5
commit 1ccb71738b

View File

@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import json import json, os
from collections import defaultdict from collections import defaultdict
from PyQt5.Qt import ( from PyQt5.Qt import (
@ -123,10 +123,10 @@ class Footnotes(object):
pass pass
def get_footnote_data(self, a, qurl): def get_footnote_data(self, a, qurl):
current_path = unicode(self.view.document.mainFrame().baseUrl().toLocalFile()) current_path = os.path.abspath(unicode(self.view.document.mainFrame().baseUrl().toLocalFile()))
if not current_path: if not current_path:
return # Not viewing a local file return # Not viewing a local file
dest_path = self.spine_path(qurl.toLocalFile()) dest_path = self.spine_path(os.path.abspath(unicode(qurl.toLocalFile())))
if dest_path is not None: if dest_path is not None:
if dest_path == current_path: if dest_path == current_path:
# We deliberately ignore linked to anchors if the destination is # We deliberately ignore linked to anchors if the destination is