summaryrefslogtreecommitdiff
path: root/summain
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-02-25 14:23:29 +0000
committerLars Wirzenius <liw@liw.fi>2012-02-25 14:23:29 +0000
commita4a011dd30194eb3f1af728a887199d99da7ec29 (patch)
tree6f0233e8faeaf5375dd8d8e752040896c49187f1 /summain
parentc2990d501379a4b8e7c84070c4453eae947578a9 (diff)
downloadsummain-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-xsummain15
1 files changed, 6 insertions, 9 deletions
diff --git a/summain b/summain
index 026a2ae..a9e7ead 100755
--- a/summain
+++ b/summain
@@ -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 = {