From a4a011dd30194eb3f1af728a887199d99da7ec29 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 25 Feb 2012 14:23:29 +0000 Subject: Fix mangling of relative paths Previously, the whole path would be mangled, rather than just the relative name. --- summain | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'summain') 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 = { -- cgit v1.2.1