Home Download Buy Blog Forum Support

Determine directory of non-file view

Determine directory of non-file view

Postby hibbelig on Sun Dec 25, 2011 11:21 pm

Is there a way to find out the directory of a non-file view? Or, better still, manipulate the directory?

I would like to create a view that is not tied to a file, and when the user hits Command+O in that view (I'm on a Mac), the file chooser comes up and I want to determine which directory that file chooser will be displaying.
hibbelig
 
Posts: 77
Joined: Wed Dec 21, 2011 11:24 pm

Re: Determine directory of non-file view

Postby sublimated on Mon Dec 26, 2011 12:10 am

use os.getcwdu() perhaps?
sublimated
 
Posts: 13
Joined: Sun Dec 18, 2011 3:58 pm

Re: Determine directory of non-file view

Postby hibbelig on Mon Dec 26, 2011 11:39 am

sublimated wrote:use os.getcwdu() perhaps?


Thank you, but I'm afraid that doesn't work. I opened a file, then opened the console and executed
Code: Select all
import os
os.getcwdu()

... and the result was "/". But Command+O showed me a different directory.

I also tried it with a dired view, and it didn't work there, either.
hibbelig
 
Posts: 77
Joined: Wed Dec 21, 2011 11:24 pm

Re: Determine directory of non-file view

Postby jps on Wed Dec 28, 2011 8:01 am

A buffer without an associated file doesn't have a directory. The virtual current directory is changed only when a buffer associated with a file is selected. There's currently no API that exposes the virtual current directory.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Determine directory of non-file view

Postby hibbelig on Wed Dec 28, 2011 11:59 am

Thanks for the clarification, Jon.
hibbelig
 
Posts: 77
Joined: Wed Dec 21, 2011 11:24 pm


Return to Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 11 guests