From a8f48c7955c45cdb9ab08dd0cd7c2554f1642833 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sat, 22 Feb 2014 17:31:08 -0500 Subject: [PATCH] Assure something that goes in as path to fullpath comes out as path --- bin/confetty | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/confetty b/bin/confetty index 614b2d46..ab283301 100755 --- a/bin/confetty +++ b/bin/confetty @@ -92,7 +92,7 @@ def rcompleter(text, state): if currpos and cline[-1] == ' ': lastarg = '' currpos += 1 - else: + elif currpos: lastarg = args[-1] if currpos <= 1: foundcount = 0 @@ -214,6 +214,8 @@ def fullpath_target(path, forcepath=False): if path == '': return target pathcomponents = path.split("/") + if pathcomponents[-1] == "": # preserve path + forcepath=True if pathcomponents[0] == "": # absolute path ntarget = path else: @@ -226,7 +228,7 @@ def fullpath_target(path, forcepath=False): del targparts[-1] else: targparts.append(component) - if forcepath: + if forcepath and targparts[-1] != "": targparts.append('') ntarget = '/'.join(targparts) if forcepath and (len(ntarget) == 0 or ntarget[-1] != '/'):