Sublime Forum

Current working directory with --new-window option

#1

A bit difficult to explain, but I’ll give it a shot.

When you run a new instance of sublime_text.exe with the --new-window command line option it uses the current working directory of the previous (first) sublime_text.exe instance.

Is there a way to fix sublime text so that subsequent instances opened set the correct current working directory (the directory sublime_text.exe --new-window was executed from)?

Failing that is there a way to set the current working directory via a command line flag?

I hope I’m making sense here. :smile:

0 Likes

#2

The working directory follows the current file, so if you open a file from the command line, it’ll pick up the desired directory. There currently aren’t any other ways of adjusting it.

0 Likes

#3

Just to clarify, I do mean subsequent instances. The first run window is the desired directory, but any after that using --new-window will not give the desired result.

[quote=“sublimator”]It doesn’t actually follow the current directory for me (on windows 7 x32)

I actually thought this may have been by some design I didn’t understand:

os.getcwd()
‘C:\Windows\system32’

I’m guessing you don’t spend much time on winblows these days :smile:[/quote]

That is the os’ working directory no?

0 Likes

#4

The processes current directory is never changed, as doing so will do blocking IO, which is something the UI avoids where possible. A separate ‘virtual’ current directory is maintained, and used where the current directory normally would be (e.g., for open/save dialogs).

0 Likes