diff --git a/twander.py b/twander.py index 62fda8e..aa2ddfb 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.106 2003/02/25 23:09:02 tundra Exp $" +RCSID = "$Id: twander.py,v 3.107 2003/02/26 04:39:33 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -2761,7 +2761,7 @@ # Walk the directory separate subdirs and files for file in os.listdir(currentdir): - d = FileDetails(file, currentdir) + d, f = FileDetails(file, currentdir) detlist.append(d) if d[0] == 'd': @@ -2781,7 +2781,7 @@ # sorts before "." dList.insert(0, ".." + PSEP) - detlist.insert(0, FileDetails(".." + PSEP, currentdir)) + detlist.insert(0, FileDetails(".." + PSEP, currentdir)[0]) # Return appropriate list - w/ or w/o details. @@ -2871,12 +2871,15 @@ ##### -# Return Details For A File Or Directory +# Get Details For A File Or Directory +# Returns Both A Formatted Display String With Detail Information, +# And A List Containing The Individual Detail Fields ##### def FileDetails(name, currentdir): details = "" + fields = [] # Condition the name @@ -2893,9 +2896,10 @@ except: pad = (UI.NameFirst - len(iNOSTAT) - 1) * " " details = pad + iNOSTAT + " " + name + fields = ["-" * 10, 0, UNAVAILABLE, UNAVAILABLE, 0L, 0, name] # Done with this file - return details + return details, fields # Do Win32-specific mode if win32all is loaded if WIN32ALL and USEWIN32ALL and WIN32ALLON: @@ -2966,9 +2970,12 @@ # Pad the result for column alignment details += PadString(mode, ST_SZMODE) + fields.append(mode) # Number of links to entry - details += PadString(str(stinfo[ST_NLINK]), ST_SZNLINK) + nlinks = stinfo[ST_NLINK] + details += PadString(str(nlinks), ST_SZNLINK) + fields.append(nlinks) # Get first ST_SZxNAME chars of owner and group names on unix @@ -3034,16 +3041,25 @@ details += PadString(owner, ST_SZUNAME) details += PadString(group, ST_SZGNAME) + # Add them to the fields + + fields.append(owner) + fields.append(group) + # Length - flen = FileLength(stinfo[ST_SIZE]) - UI.TotalSize += stinfo[ST_SIZE] + rlen = stinfo[ST_SIZE] + flen = FileLength(rlen) details += PadString(flen, ST_SZLEN) + fields.append(rlen) + UI.TotalSize += rlen # mtime + rawtime = stinfo[ST_MTIME] + # Get the whole time value - ftime = time.ctime(stinfo[ST_MTIME]).split()[1:] + ftime = time.ctime(rawtime).split()[1:] # Pad single-digit dates with leading space @@ -3057,9 +3073,11 @@ ftime = " ".join(ftime) details += PadString(ftime, ST_SZMTIME) + fields.append(rawtime) # Add the File Name details += name + fields.append(name) # Include symlink details as necessary if details[0] == 'l': @@ -3075,7 +3093,7 @@ details += SYMPTR + f - return details + return details, fields # End of 'FileDetails()'