diff --git a/tren.py b/tren.py index e0d5cb1..54fed8f 100755 --- a/tren.py +++ b/tren.py @@ -9,7 +9,7 @@ BASENAME = PROGNAME.split(".py")[0] PROGENV = BASENAME.upper() INCLENV = PROGENV + "INCL" -RCSID = "$Id: tren.py,v 1.227 2010/08/25 19:26:25 tundra Exp $" +RCSID = "$Id: tren.py,v 1.228 2010/08/25 19:47:35 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -2045,9 +2045,18 @@ # or from a Windows shell that doesn't know how to handle globbing # properly. +# If the glob expands to nothing, then supply the original string. +# That way an error will be thrown if either an explicitly named file +# does not exist, or if a wildcard expands to nothing. + expandedlist = [] for arg in args: - expandedlist += glob.glob(arg) + + wc = glob.glob(arg) + if wc: + expandedlist += wc + else: + expandedlist.append(arg) targs = RenameTargets(expandedlist)