1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Directory history file and global directory history

Discussion in 'Support' started by David Marcus, Sep 11, 2011.

  1. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    I have global directory history (i.e., "Local Directory History" is not checked) and I have a Directory History File specified. But, each time I do Ctrl-T in TCmd, the directory history file is loaded.

    I don't understand the statement in the Help that "TCC can only guess (based on the TCMD.INI inheritance)". What is TCMD.INI inheritance?

    What I used to do (long ago before the Directory History File option was added) was check in TCStart.btm to see if the directory history list was empty and only load my directory history file if it was. I guess that isn't what TCC is doing.

    TCC 13.00.19 Windows Vista [Version 6.0.6002]
     
    #1
  2. ron

    ron

    Joined:
    Aug 19, 2008
    Messages:
    95
    Likes Received:
    0
    If you specify any history file, TCMD will reload that file on startup and whenever another TCC window is opened, overwriting any history you had accumulated.

    Are you implying that it also does this when you invoke the command to display the directory history?
     
    #2
  3. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    I didn't mean to imply it has anything to do with TCmd. I just meant that it happens when I start a new TCC, e.g., in a tab.

    This was supposed to be changed in V13. It was one of the feedback requests (which is marked "Competed"):

    http://jpsoft.uservoice.com/forums/...ry-file-check-for-global-directory-?ref=title

    And, the What's New says, "The persistent directory history file is now only loaded if either local directory history is set, or TCC thinks it is the first instance. But since there's no such thing as 'shell levels' in Windows, TCC can only guess (based on the TCMD.INI inheritance)."
     
    #3
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,487
    Likes Received:
    9
    On Mon, 12 Sep 2011 22:36:48 -0400, David Marcus <> wrote:

    |And, the What's New says, "The persistent directory history file is now only loaded if either local directory history is set, or TCC thinks it is the first instance. But since there's no such thing as 'shell levels' in Windows, TCC can only guess (based on the TCMD.INI inheritance)."

    I suspect that when tabs are involved (TCCs started by TCMD) every one will
    think it's the first because it wasn't started by another TCC.
     
    #4
  5. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    I don't really understand why this is so hard. If it is hard, then I'll just do it myself in TCStart.btm.

    When TCC starts with global history (command or directory), it has to connect to the global history. I don't know if it can tell if the global history already existed or if it is creating it. If it can tell, it knows whether to load the history file. If it can't tell, it can check whether the global history is empty. If it is empty, it loads the history file. If it is not empty, it does not load the history file.

    As for exiting, if it can tell if other instances are still using the global history, then it knows whether to write the history file. If it can't tell, it could just always write the history file. The last one to exit will write the final history file, which can then be loaded the next time a TCC starts.
     
    #5
  6. ron

    ron

    Joined:
    Aug 19, 2008
    Messages:
    95
    Likes Received:
    0
    Well duh, I forgot that - even after griping about it. Anyway, I just tested it with the last beta build (I know, I'm behind) and it seems to be working as it should. Set up both cmd and dir histories, exited, restarted tcmd, entered commands, exited so they would save, restarted tcmd, commands are there, enter a new command, open a new tcc tab, the new command is in the history - not overwritten.

    Correction, that test was with 13.0.19.
     
    #6
  7. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    Doesn't work for me with either command or directory history.

    TCC 13.00.19 Windows Vista [Version 6.0.6002]
     
    #7
  8. ron

    ron

    Joined:
    Aug 19, 2008
    Messages:
    95
    Likes Received:
    0
    Ok, now I'm seeing something unexpected. I'll note that in this test VM I'm not using Shralias but all histories are 'global'.

    Opening up TCMD, I get the history from yesterday.

    Enter the command wacka, then open a new tab. The wacka command is in the history. BUT, the history seems larger.

    Subsequently opened 4 more tabs and noted the history doubled in size each time. Looking at the command history, everything was duplicated except for wacka. After opening the 4th tab, the history was 4 times the size of the original will duplicate entries for all except for wacka.

    My TCC prefs are move to end, save last.

    It's certainly not wiping out the existing history (for me) as 12.x did but is appending to the history in memory 'each' time a tcc window is opened.
     
    #8
  9. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    My tests are without shralias, with "Move to end" and "Wrap" checked, and with "Save Last" selected.

    Usually, I use local command history and global directory history.
     
    #9
  10. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    Am I imagining this or does it not work as it should?
     
    #10
  11. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    Is this a bug?
     
    #11
  12. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,179
    Likes Received:
    21
    No, it's you requesting a feature that isn't doable in Windows.
     
    #12
  13. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    What's wrong with the algorithm I posted in message #5 in this thread, i.e.:

    "When TCC starts with global history (command or directory), it has to connect to the global history. I don't know if it can tell if the global history already existed or if it is creating it. If it can tell, it knows whether to load the history file. If it can't tell, it can check whether the global history is empty. If it is empty, it loads the history file. If it is not empty, it does not load the history file.

    "As for exiting, if it can tell if other instances are still using the global history, then it knows whether to write the history file. If it can't tell, it could just always write the history file. The last one to exit will write the final history file, which can then be loaded the next time a TCC starts."
     
    #13
  14. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,179
    Likes Received:
    21
    Nothing, except that it requires a lot of interprocess communications
    between unrelated TCC instances that doesn't currently exist.

    And there isn't any way for a TCC instance to tell if somebody else is using
    the global history -- at least, not without injecting code into every other
    process. (And I won't be doing that.)

    You're requesting a feature, not reporting a bug.
     
    #14
  15. ron

    ron

    Joined:
    Aug 19, 2008
    Messages:
    95
    Likes Received:
    0
    So would it be fair to say that using a global history setting and specifying "History File" and "Directory History" files is not recommended? Otherwise each new session reloads the same file, every time, appending to any previously loaded history from other sessions.

    *update* Guess I need to 'refresh' right before posting :-) I understand the explanation below now - just didn't know for certain if that was why I was seeing the behavior.
     
    #15
  16. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    Can't you avoid the interprocess communication if you do the following:

    When TCC starts with global history (command or directory), it checks whether the history is empty. If it is empty, it loads the history file. If it is not empty, it does not load the history file. When TCC exits, it always writes the history file.

    Do you mean when it exits or also when it starts?. Can it tell when it starts if the global history already existed?

    Indeed I did request this feature before V13 came out:

    http://jpsoft.uservoice.com/forums/...ry-file-check-for-global-directory-?ref=title

    The feature request is marked as "completed", but it doesn't do what I was requesting. So, what was implemented? I don't see any difference between V12 and V13 in how this works.
     
    #16
  17. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,179
    Likes Received:
    21
    starts

    I was referring to the exit.

    It can tell at startup if the global history already existed, but that
    doesn't mean that there's one or more active TCC processes. (You could have
    SHRALIAS running.)
     
    #17
  18. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    I think if someone runs SHRALIAS, they can take responsibility for loading the history themselves. Or, there could be an option for the user to specify what happens in this case. I haven't been running SHRALIAS, so I'm more interested in what happens when SHRALIAS isn't running.

    Rex, What's the status with this? Are you going to change it, should I add it back to the feedback page (I still don't understand what change you made in V13 that led to marking this as completed), and/or should I fix it myself in my tcstart.btm?
     
    #18
  19. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,179
    Likes Received:
    21
    I will not be changing this in v13.
     
    #19
  20. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    #20
  21. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,487
    Likes Received:
    9
    I have always used SHRALIAS and never considered a dirhistory file. Having considered it a little, I can see only two uses for it.

    (1) ... with global dirhistory, as a replacement for SHRALIAS ... in which case, it should work as David proposes ... read by a TCC started when no others are running and written at exit by a TCC that will leave no others running ... anything else and you don't really have a global (shared) dirhistory

    (2) ... with local dirhistory ... to load a basic set of frequented directories; if that were my intent, I'd want it loaded by every instance of TCC.

    Do others see it differently?
     
    #21
  22. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    901
    Likes Received:
    4
    I'm probably the odd-man out in this group.
    I never use global lists or SHRALIAS. I almost exclusively
    work from a single instance of TCC running in TCMD. On the rare occasions
    when I start additional tabs, I usually don't care about the histories
    of other tabs. That being said, I do have specialty code in my TCSTART
    file to restore my work environment if I choose to do that.

    My work environment consists of:
    the environment (i.e. SET)
    aliases
    dirhistory
    history
    and CWD's of each drive (the output
    of CDD /A).

    Code:
    set s=Y
    inkey /c /k"YN[Enter]" /w10
    /x Restore Previous Environment? (Yn) %%s
    echo.
    iff "%s" eq "Y"
    .OR. "%s" eq "@28" then
      for %%s in (@c:\JPSOFT\drives.dat)
    do cdd %%s
      set /r c:\JPSOFT\env.dat
      dirhistory /r c:\JPSOFT\dirhist.dat
      history /r c:\jpsoft\history.dat
    endiff
    
    -Scott

    vefatica <> wrote on 10/19/2011
    07:58:14 PM:



    in



     
    #22
  23. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    577
    Likes Received:
    0
    In which case, you probably wouldn't want TCC to overwrite your file when it exits, would you?
     
    #23
  24. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,487
    Likes Received:
    9
    On Wed, 19 Oct 2011 21:12:23 -0400, David Marcus <> wrote:

    |---Quote (Originally by vefatica)---
    |(2) ... with local dirhistory ... to load a basic set of frequented directories; if that were my intent, I'd want it loaded by every instance of TCC.
    |---End Quote---
    |In which case, you probably wouldn't want TCC to overwrite your file when it exits, would you?

    Very correct! I didn't think of that.
     
    #24

Share This Page