diff --git a/tdir b/tdir index 80cfd3a..5f79a6d 100755 --- a/tdir +++ b/tdir @@ -12,7 +12,7 @@ # Version info -VERSION = "$Id: tdir,v 1.65 2001/07/21 20:10:06 tundra Exp $" +VERSION = "$Id: tdir,v 1.66 2001/07/21 20:38:29 tundra Exp $" # Booleans @@ -41,16 +41,22 @@ def OrderByExtension(list): ExtList = {} ExtList[""] = [] # List of files with no extension + for x in list: y = x.rfind(SEP) - if y != -1: # File has extension - ext = x[y+1:] + if not y: # Handle special case of 'dot file' type files + ext = "" + name = x + elif y != -1: # File has extension + ext = x[y:] name = x[:y] if not ExtList.has_key(ext): ExtList[ext]= [] - ExtList[ext].append(name) else: # File has no extension - ExtList[""].append(x) + ext = "" + name = x + ExtList[ext].append(name) + return ExtList @@ -95,11 +101,7 @@ FileList = ExtList[x] if len(FileList) > 0: FileList.sort() - if x == "": - sep = x - else: - sep = SEP - sys.stdout.write("{" + sep + x + "}\n") + sys.stdout.write("(" + x + ")\n") OutputColumns(FileList, FALSE) else: