diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-02-25 14:23:29 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-02-25 14:23:29 +0000 |
commit | a4a011dd30194eb3f1af728a887199d99da7ec29 (patch) | |
tree | 6f0233e8faeaf5375dd8d8e752040896c49187f1 /summain | |
parent | c2990d501379a4b8e7c84070c4453eae947578a9 (diff) | |
download | summain-a4a011dd30194eb3f1af728a887199d99da7ec29.tar.gz |
Fix mangling of relative paths
Previously, the whole path would be mangled,
rather than just the relative name.
Diffstat (limited to 'summain')
-rwxr-xr-x | summain | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -150,10 +150,8 @@ class Summain(cliapp.Application): for filename in self.files(root): o = summainlib.FilesystemObject(filename, nn, pn, exclude) if relative: - name = self.relative_path(root, o) - else: - name = o['Name'] - yield name, o + o.relative = self.relative_path(root, o) + yield o['Name'], o def relative_path(self, root, o): '''Return a path that is relative to root, if possible. @@ -167,13 +165,12 @@ class Summain(cliapp.Application): root2 = root else: root2 = root + os.sep - pathname = o['Name'] - if pathname.startswith(root2): - return pathname[len(root2):] - elif pathname == root and o.isdir(): + if o.filename.startswith(root2): + return o.filename[len(root2):] + elif o.filename == root and o.isdir(): return '.' else: - return pathname + return o.filename def new_formatter(self, checksums, objects): table = { |