diff --git a/twander.py b/twander.py index 50883f0..9d30da0 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ # For Updates See: http://www.tundraware.com/Software/twander PROGNAME = "twander" -RCSID = "$Id: twander.py,v 2.32 2002/12/23 15:19:11 tundra Exp $" +RCSID = "$Id: twander.py,v 2.33 2002/12/23 21:41:37 tundra Exp $" VERSION = RCSID.split()[2] @@ -681,6 +681,20 @@ ##### +# Strip Trailing Path Separator +##### + +def StripPSEP(s): + + if s[-1] == PSEP: + return s[:-1] + else: + return s + +# End of 'StripPSEP()' + + +##### # Print Usage Information ##### @@ -1018,15 +1032,19 @@ return # Now do files & directories + # Strip trailing path separators in each case to + # give the command author the maximum flexibility possible - selection = UI.LastInSelection() + selection = StripPSEP(UI.LastInSelection()) selections = "" dselections = "" for selected in UI.AllSelection(): - dselections += QUOTECHAR + UI.CurrentDir + selected + QUOTECHAR + " " + selected = StripPSEP(selected) + dselections += QUOTECHAR + UI.CurrentDir + selected + QUOTECHAR + " " + selections += QUOTECHAR + selected + QUOTECHAR + " " - cmd = cmd.replace(DIR, QUOTECHAR + UI.CurrentDir + QUOTECHAR) + cmd = cmd.replace(DIR, QUOTECHAR + StripPSEP(UI.CurrentDir) + QUOTECHAR) cmd = cmd.replace(DSELECTION, QUOTECHAR + UI.CurrentDir + selection + QUOTECHAR) cmd = cmd.replace(DSELECTIONS, dselections) cmd = cmd.replace(HASH, COMMENT)