1
$\begingroup$

I use windows system and Mathematica 10

The default working directory is c:\\user\\name\\document

If I type Import["xx , Mathematica show a list to let me select matched directory or file under document. Effect like this

filename

the link is here

Now I change working directory to NotebookDirectory by

SetDirectory[NotebookDirectory[]]

However, Import["xx still matches files and directory original document, doesn't show any file in the NotebookDirectory[], what is wrong?


Update

according to MarcoB and george2079, there is an option called NotebookBrowseDirectory, whenever one opened a file via file menu, it changes to that directory.

However the problem is, this option is not relevant to the drop down list effect I want. It only affect the directory open by this file browser button.

enter image description here

However, the auto filename match is still point to c:\\user\\name\\document. Is it a bug? It doesn't conform to the good looking wolfram document.

$\endgroup$
1
$\begingroup$

It appears that the File Browser interface ignores the current directory set by SetDirectory; instead, it always uses the last directory from which it was opened, at least on my system (MMA 10.4 Win7-64).

This seems to be controlled by a NotebookBrowseDirectory which is partially documented as "a global option that determines the current working directory". You can check out its value using the Options Inspector, under General.

Note that attempting to change the value of the NotebookBrowseDirectory from the Options Inspector crashed my Mathematica, so handle with care!

$\endgroup$
  • $\begingroup$ Hi, MarcoB. I don't understand your answer. I changed NotebookBrowseDirectory, however it doesn't change anything $\endgroup$ – matheorem Mar 26 '16 at 7:12
  • $\begingroup$ @matheorem to be honest, I don't understand the inner workings of the front end either... I think you made a good point about the option only affecting the FileBrowser behavior, but I haven't tested it yet. $\endgroup$ – MarcoB Mar 26 '16 at 11:27
0
$\begingroup$

I think its left to the OS which seems to take you to the last directory where you opended a file ( via file menu, etc )

If you are doing lots of this here is a little trick, evaluate this:

 fopen := SystemDialogInput["FileOpen", Directory[]]

Now when you need an inline file name :

 Import[fopen];

Now highlight the "fopen" and shift-control-enter (evaluate in place) to pop up a file open dialog in the working directory. Whatever file you select gets pasted in as a string.

$\endgroup$
  • $\begingroup$ Hi, george2079. I updated my post. Have a look: ) $\endgroup$ – matheorem Mar 26 '16 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.