Updated to work with non-absolute selfs again.

This commit is contained in:
Jeremy Fincher 2004-08-28 05:37:52 +00:00
parent ae4b8f7861
commit bb3df205f2

View File

@ -539,11 +539,16 @@ class Directory(registry.String):
return v return v
def dirize(self, filename): def dirize(self, filename):
myself = self()
if os.path.isabs(filename): if os.path.isabs(filename):
selfAbs = os.path.abspath(self()) filename = os.path.abspath(filename)
selfAbs = os.path.abspath(myself)
commonPrefix = os.path.commonprefix([selfAbs, filename]) commonPrefix = os.path.commonprefix([selfAbs, filename])
filename = filename[len(commonPrefix)+1:] # +1 for extra /. filename = filename[len(commonPrefix)+1:] # +1 for extra /.
return os.path.join(self(), filename) elif not os.path.isabs(myself):
if filename.startswith(myself):
filename = filename[len(myself):]
return os.path.join(myself, filename)
class DataFilename(registry.String): class DataFilename(registry.String):
def __call__(self): def __call__(self):