diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-08-08 14:51:34 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-08-08 14:51:34 +0100 |
commit | d302e6765609392389b48be701998943975843bb (patch) | |
tree | 568dfa6610d7b3deb0d2a7143b73afa6fa8cb969 | |
parent | 68f67f9b71e1bbc9647d350cb6b62d72ebfbeab9 (diff) | |
download | summain-d302e6765609392389b48be701998943975843bb.tar.gz |
Fix relative pathnames.
-rwxr-xr-x | summain | 6 | ||||
-rw-r--r-- | summainlib.py | 2 |
2 files changed, 4 insertions, 4 deletions
@@ -99,13 +99,13 @@ class Summain(cliapp.Application): for filename in self.files(root): o = summainlib.FilesystemObject(filename, nn, pn, exclude) if relative: - name = self.relative_path(root) + name = self.relative_path(root, o) else: name = o['Name'] fmt.write_object(name, o, checksums) fmt.close() - def relative_path(self, root): + def relative_path(self, root, o): '''Return a path that is relative to root, if possible. If pathname does not start with root, then return it @@ -120,7 +120,7 @@ class Summain(cliapp.Application): pathname = self['Name'] if pathname.startswith(root2): return pathname[len(root2):] - elif pathname == root and self._isdir(): + elif pathname == root and o.isdir(): return '.' else: return pathname diff --git a/summainlib.py b/summainlib.py index 9d8ac54..34dad47 100644 --- a/summainlib.py +++ b/summainlib.py @@ -231,7 +231,7 @@ class FilesystemObject(object): raise KeyError(key) return self.values.get(key, '') - def _isdir(self): # pragma: no cover + def isdir(self): # pragma: no cover '''Is this a directory?''' return stat.S_ISDIR(int(self['Mode'], 8)) |