Home Download Buy Blog Forum Support

current working directory with --new-window option

current working directory with --new-window option

Postby atomi on Fri Sep 09, 2011 4:12 pm

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. :)
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: current working directory with --new-window option

Postby jps on Mon Sep 12, 2011 1:59 am

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.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: current working directory with --new-window option

Postby atomi on Mon Sep 12, 2011 2:56 am

jps wrote: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.


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.

sublimator wrote: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 :)


That is the os' working directory no?
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: current working directory with --new-window option

Postby jps on Mon Sep 12, 2011 8:14 am

sublimator wrote:It doesn't actually follow the current directory for me (on windows 7 x32)

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).
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot] and 16 guests