Directory stack empty when running TCEXIT?

Sep 24, 2013
42
1
I'm not sure when this behavior changed, or even if I've erroneously made some configuration change that caused it. So throwing this out there to see if anyone else sees the same thing.

I have TCEXIT.CMD script that saves some information for each open tab. I recently noticed (no idea when it started) that the directory stack wasn't being saved. After some debugging, it became clear that regardless of the state of the directory stack in a tab, when the TCEXIT is run the stack is empty. I confirmed this with a simple "echo %@dirstack[] >> C:\X\debug.txt" in my TCEXIT that clearly shows it's always returning 0.

I'm presently running 25.0.30. I've tried reverting to 25.0.25 (the oldest 25 version I have) and see the same behavior.
 
Jun 2, 2008
376
2
Newton, MA
In my TCEXIT file, I save the most recent directory history using "dirhistory | tail /n 30 > c:\tcmd\ver25\dirhist.sav" so that I can restore it when I start up again. Why do you want to save the directory stack?
 
Sep 24, 2013
42
1
If I do a DIRS before TCEXIT, it shows the full stack. During TCEXIT, it outputs nothing. I'll assume it's something I screwed up in my config and look for it later.

I don't use directory history. I've been using Unix for 40 years and the shell's pushd/popd/dirs commands are second nature to me. I long ago wrote batch file thin wrappers around the TCC (and 4NT and 4OS2 before that) versions to give more Unix-like behavior (e.g. pushd with no args swaps the top two directories on the stack).
 
Sep 24, 2013
42
1
I had a bit of time to further investigate and have some further information.

If I close a tab via "EXIT", all is well - the directory stack is saved. However if I exit via the Home/Exit menu item (i.e. am closing Take Command), the directory stack is empty when running TCEXIT.

Is this WAD? I'm pretty sure this hasn't always been the behavior. I do realize the limited time to run TCEXIT, but I'm not doing anything time consuming, just dumping history & directory stack to a file.
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
This was changed in v25 -- the directory stack is stored in thread local storage for the main TCC thread. When you close TCC from another app (like TCMD) it gets the shutdown message and does the shutdown in a new thread, which has no directory stack.

I can move the directory stack back to global storage, though that will break a couple of other things. I'll have to think about how to work around it.
 
Sep 24, 2013
42
1
Thanks Rex.

While I'd appreciate the old behavior being restored, should it prove to be either a non-trivial performance hit or cause unwanted side-effects, don't sweat it. I've already implement a workaround by augmenting my existing pushd/popd/dirs scripts to always keep an up-to-date on-disk copy so I don't need to dump it in TCEXIT. That has the side benefit of having the list be up-to-date even if TCC is forcibly killed or if the box crashes. It does also have the downside of not reflecting any directory stack manipulation done outside of thise scripts (e.g. if I did a *popd for some reason), and possibly a trivial impact on pushd/popd speed, but those are minor considerations.

Given that it's taken this long for the change to be noticed, I can't imagine there are a lot of users relying on the old behavior. Though should the current behavior be retained, it should probably be documented somewhere.
 
Sep 24, 2013
42
1
Any update on this Rex? Is this still a change you're considering?

My workaround is functional, but not as convenient or as performant as the pre-v25 behavior.
 
Sep 24, 2013
42
1
Sweet. Thanks Rex. It seems to have been missed in the changelog, so I was unaware of the change in v26.
 
Similar threads
Thread starter Title Forum Replies Date
D Directory stack empty Support 1
fishman@panix.com HELP!! I just updated to Version 28 and as usual I cannot make extended directory search work. Support 2
D How to use multi-line DO to loop through first level directory names Support 5
D ParentDirectory does not update directory history Support 6
samintz CDD to non-existent directory hangs Support 2
gworley rd (Remove Directory) gives interesting error: Support 2
D Directory History Window with wildcard search Support 3
D How to? Skip removing directory (RMDIR) without error message Support 2
vefatica Disable extended directory searches (completely)? Support 8
M WAD "Pictures" directory is empty in TCC but not in CMD or Explorer Support 4
G Local Directory Corruption Support 11
Jay Sage Directory Alias Access to FTP Servers Support 2
Joe Caverly DIRectory Colorization in v25 Help File Support 0
K copy changing destination current directory Support 1
thorntonpg option /u not working The directory name is invalid Support 5
J built in file explorer - how do i go back "up" the directory? Support 2
vefatica Extended directory searches? Support 6
Joe Caverly Using a Directory Alias with @iniwrite fails Support 14
A Installer /extract: extracts into current directory if target not exists Support 12
Charles Dye Ctrl-Shift-Up doesn't update directory history Support 1
G Extended directory search not working Support 4
CWBillow Editing in the root directory of windows 10 Support 6
J directory or folder to start in Support 2
M How to unlock a directory Support 1
Alpengreis Fixed TCMD FileExplorer Start-Directory problem Support 4
R V19 - At startup, TCC save directory in the directory history list Support 2
C Touch command — I Need to touch matching files in another directory. Support 5
nickles Move takecommand.18.0.key location to installation directory Support 4
fishman@panix.com Extended Directory Searches are not working for me in CDD Support 9
vefatica TCMD's current directory? Support 4
J How to set working directory Support 10
nickles How to? Follow a JUNCTION type directory link Support 9
Steve Pitts WAD Strange output from DEL of a non-existent directory Support 7
I tab completion with directory commands Support 7
vefatica Start-up directory for new tabs? Support 7
cgunhouse Problem with CALL and Directory Aliases in V17 Support 9
vefatica FFIND /S, find directory with specified name? Support 7
David Wilbanks How to make new tab open in same directory as previous tab? Support 4
H WAD Wild Card in Directory @shfolder[25] acting differently Support 3
M How to? List path getting short file and directory names... Support 10
A How to? Can't change directory ("cd") into system hidden files Support 13
mfarah How to? So I want a custom directory for the plugins... Support 16
D Why doesn't ffind find directory? Support 3
T dir /h error in empty directory Support 22
S directory history locks up TCC Support 3
B Why Does @GETDIR Repeat Selected Directory Name In Returned Value Support 7
ed neff How to? exit TCC/Take Command to a new directory Support 10
Jake Default directory Support 3
Frank ZIP: howto store directory in the zip-file Support 20
S WAD %_do_errors does not report errors when loop control variable type is not directory entry Support 1

Similar threads