This commit is contained in:
Kovid Goyal 2008-06-28 20:16:38 -07:00
parent b67305911f
commit 566665a057
2 changed files with 6 additions and 3 deletions

View File

@ -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.

View File

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