I find Mathematica handling of directories utterly bizarre to say the least. I end up losing changes and seeing files saved in wrong folder due to this. Even in Version 10.01 which I am using, on windows 7.
I open a notebook, say in /A/index.nb
. The NotebookDirectory[]
shows it is /A
correctly. Now if I just do File->Save..
the notebook will be saved in /A
. However, if I want to save the notebook as PDF, then I do File->SaveAs..
now the popup window that comes up is not the same as NotebookDirectory[]
, which is what I expect, but it is Options[$FrontEnd, NotebookBrowseDirectory]
which can be different. (it seems to depend on where one used SaveAs..
last time.)
What is even more confusing is that M says this
So, the current working directly is the last saved to directory??
Sometimes I do not notice the folder in the File dialogue menu that comes up, expecting it to naturally to be the same as the notebook directory of the notebook I am currently using, and end up saving the notebook as PDF in the wrong folder.
Since I have many notebooks open at the same time, in many different folders (and I names them index.nb, and I save as PDF and HTML all the time, I am always making a mistake in saving wrong files in wrong locations due to this. Or I spend lots of time changing directories manually with the File dialogue.
A simple solution is to make Options[$FrontEnd, NotebookBrowseDirectory]
always the same NotebookDirectory[]
. I do not see any need to have it something else right now.
Is there a way to automatically tell Mathematica to do this? May be in preferences? I can see NotebookBrowseDirectory
in preferences, but it is string. I need it to be NotebookDirectory[]
all the time.
Related question How to set default save directory for notebooks? but I did not see how the answers there solve this problem.