mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:...
This commit is contained in:
parent
b67305911f
commit
566665a057
@ -409,8 +409,8 @@ def relpath(target, base=os.curdir):
|
||||
target_list = (os.path.abspath(target)).split(os.sep)
|
||||
|
||||
# On the windows platform the target may be on a completely different drive from the base.
|
||||
if iswindows and base_list[0] != target_list[0]:
|
||||
raise OSError, 'Target is on a different drive to base. Target: '+target_list[0].upper()+', base: '+base_list[0].upper()
|
||||
if iswindows and base_list[0].upper() != target_list[0].upper():
|
||||
raise OSError, 'Target is on a different drive to base. Target: '+repr(target)+', base: '+repr(base)
|
||||
|
||||
# Starting from the filepath root, work out how much of the filepath is
|
||||
# shared by base and target.
|
||||
|
@ -83,7 +83,10 @@ class Resource(object):
|
||||
frag = '#'+quote(self.fragment) if self.fragment else ''
|
||||
if self.path == basedir:
|
||||
return ''+frag
|
||||
rpath = relpath(self.path, basedir)
|
||||
try:
|
||||
rpath = relpath(self.path, basedir)
|
||||
except OSError: # On windows path and basedir could be on different drives
|
||||
rpath = self.path
|
||||
|
||||
return quote(rpath.replace(os.sep, '/'))+frag
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user