Bug introduced in 10.2 and fixed in 11.1
I have found that LocalSymbol
will sometimes create and store persistent data in a directory different from and off the path of the one specified in its second argument.
Contents of a notebook demonstating the problem
I created a directory Test Folder on my desktop and saved the notebook the content of wto it as 'test.nb.
NotebookDirectory[]
"/Users/oldmg/Desktop/Test Folder/"
I then made a local symbol.
LocalSymbol["testData", NotebookDirectory[]] = "Hello, world";
LocalSymbol
has no problem in retrieving the data.
LocalSymbol["testData", NotebookDirectory[]]
"Hello, world"
However, the data is not stored in the directory specified.
FileExistsQ[FileNameJoin[{NotebookDirectory[], "testData"}]]
False
Here is the directory structure that was created.
I am disturbed by this behavior. It is important to me that all the files belonging to one of my projects be stored in the directory of my choice.
This behavior raises two questions.
- Why does Mathematica do this?
- What work-arounds might be used to ameliorate its effects?
$LocalSymbolBase
has a space in it too. What will happen then? Will Mathematica start creating directories with a+
in the name inC:\Users
? That would certainly be a serious bug! I cannot test this because on the Windows computer which I occasionally have the chance to use I already changed the username to have no spaces. When it did have spaces before, it caused problems with some ported Unix tools. But a proper Windows application like Mathematica should not be tripped up by a space in the username. $\endgroup$file:///
paths are more common in v11 and have no issues with spaces. The documentation also says thatLocalSymbol[relpath, File["path"]]
is valid, which makes it pretty clear that the second argument can be any local file system path. (Note: addingFile
won't fix the problem.) To me this is clearly a bug. But since we disagree, I would prefer not to touch the tag myself anymore and let someone else handle it. $\endgroup$