Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stopping Stata from changing the working directory when opening a log (or .dta) file from the finder

    This may be a little esoteric, but is there any way to stop Stata from changing the current interactive directory when opening a file via the OS. OSX changes the working directory to the folder containing the file when you ask it to open a log file (or a .dta file) by clicking on it in the Finder window and having OSX open it with Stata. It exhibits the same behavior when you open that file from Terminal. This might be desirable behavior for opening a data file, but certainly not when trying to open a log file from the OS. Every time I do this, I always have to put myself back into the directory I was in before. Sometimes I forget, and I end up interacting with the wrong directory for a while. Windows doesn't seem to exhibit this behavior.

    Is there a way to change this behavior?

  • #2
    Malcolm Wardlaw, were you able to find an answer to this? When I'm running a long operation in Stata which is saving files to directories, I want to work on other do files in the meantime. But because Stata changes directories when I open those do files, the operation breaks because it's expecting the directory I specify at the top of the do file.

    Comment


    • #3
      I suspect this is not possible. First, the fact that O.P. never got a response suggests that, if it can be done at all, it is probably obscure. Moreover, in Windows, the problem you are encountering does not happen. If I am running something in one directory and I use the do-file editor to open a do-file from another directory, the working directory does not change. If I open the do-file by double-clicking on it in its own directory, the do-file opens in a new instance of Stata, with this new instance's working directory being the one containing the do file, but the original instance is not affected at all.

      So I think what you are encountering is some inherent behavior of your Mac OS and is unlikely to be something that can be modified within Stata. But maybe there is a Mac user out there who knows more about this than I do.

      Comment


      • #4
        It is possible to run a second instance on a Mac. I also thought this was not possible but found this shell script that can be placed into a shortcut and just run/selected from the shortcut menu. If I could remember where I found it I would let you know as someone smarter that me did this!

        Shell script: open -n /Applications/Stata/StataMP.app (if StataMP version for example)

        I can't post a screenshot of the actual shortcut as is not allowed on Statalist.

        Comment

        Working...
        X