diff --git a/twander.py b/twander.py index 4baaace..767ef16 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.230 2009/07/01 00:44:39 tundra Exp $" +RCSID = "$Id: twander.py,v 3.231 2009/07/01 07:29:20 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -4180,7 +4180,6 @@ # We'll need the nominal refresh interval later nominal = UI.OptionsNumeric["REFRESHINT"] - # Check to see if SORTBYFIELD makes sense if SORTBYFIELD.lower() not in Name2Key.keys(): @@ -4219,6 +4218,12 @@ if currentdir != SHOWDRIVES: + # Save the current OS directory context and temporarily set it + # to the target directory + + cwd = os.path.abspath(os.path.curdir) + os.chdir(currentdir) + # Get and sort directory contents filelist = os.listdir(currentdir) @@ -4240,8 +4245,8 @@ # Pay attention to pickup symlinks pointing to directories if detail[0] == ST_SPECIALS["04"] or os.path.isdir(detail.split(SYMPTR)[-1].strip()): - file += PSEP - detail += PSEP + file += PSEP + detail += PSEP # Check against any active filtering by wildcard. Only allow files through that match. @@ -4381,6 +4386,10 @@ # OSs like Win32 like to use '$' in file names which # sorts before "." + # Restore the original directory context + + os.chdir(cwd) + # Dynamically adjust refresh interval if option enabled if ADAPTREFRESH: