I know of no better way than to just look in the local symbols directory. While it's not necessarily true that all local symbols are stored there, it should be true of the defaults (that is, those made as LocalSymbol["name"]
).
Now, $LocalSymbolBase
is a string with a protocol prefix (presumably to match it up with $CloudSymbolBase
, although since that is a CloudObject
anyway, I'm not sure that the matching-up is very good). Therefore, we can't SetDirectory
to it immediately. I don't know of a way to get rid of that using a built-in, so I'll just do the following:
removePrefix[str_String] := If[StringTake[str, 7] === "file://", StringTake[str, 8;;], str]
Then the function you want is:
Module[{ret},
SetDirectory[removePrefix@$LocalSymbolBase];
ret = FileNames[];
ResetDirectory[];
ret
]
FileNames[$LocalSymbolBase]
should get most of them. $\endgroup$In[7]:= LocalSymbol["ab"] = 1 Out[7]= 1 In[8]:= FileNames[$LocalSymbolBase] Out[8]= {}
$\endgroup$FileNames
doesn't do what I remembered it doing.SetDirectory[$LocalSymbolBase]; FileNames[]
would work instead, except that for some unearthly reason$LocalSymbolBase
has a protocol on the front, so it isn't directly a directory. $\endgroup$SetDirectory::cdir: Cannot set current directory to file:///Users/Library/Wolfram/Objects/LocalSymbols. >>
$\endgroup$file://
protocol from the front. $\endgroup$