19
$\begingroup$

Since upgrading to version 10.2.0.0, every time I start the Mathematica front-end it creates a "Wolfram Mathematica" directory under my home directory. (It never seems to put anything in it.) Anybody know how to prevent this behaviour?

$\endgroup$
15
$\begingroup$

The "Wolfram Mathematica" directory is created automatically by the front-end and is located in $UserDocumentsDirectory.

It is the default directory to save new documents in and also is on TrustedPath.

The typical location for Linux systems is $HOME/Documents, however it may happen to fall back on $HOME depending on the Xdg user directories setting. This can be changed by

xdg-user-dirs-update --set DOCUMENTS AnyDesiredDirectory
which can prevent the home directory cluttering behavior by using another location.

$\endgroup$
  • $\begingroup$ Thanks for the information. I take it this means I can't prevent it? For now I've just put a RemoveDirectory in my init.m $\endgroup$ – Matt Pusey Jul 28 '15 at 23:31
  • $\begingroup$ @Matt Correct, no way to prevent the creation of that directory, but it is possible to change its location in case the home directory is objectionable. $\endgroup$ – ilian Jul 28 '15 at 23:37
  • 4
    $\begingroup$ Is this the intended behavior? Or is this faulty behavior? I don't really like a "Wolfram Mathematica" directory under my ~/Documents directory. $\endgroup$ – Andreas Lauschke Aug 10 '15 at 14:32
  • 1
    $\begingroup$ @Andreas It is the intended behavior. Personally I think users should have more control over this -- I would recommend sending feedback to support so they can file a formal suggestion on your behalf. $\endgroup$ – ilian Aug 10 '15 at 15:47
  • 1
    $\begingroup$ @nix On OS X the location is determined by querying for NSDocumentsDirectory via the NSSystemDirectories API, I am not sure if the operating system allows users to override this in any way. $\endgroup$ – ilian Sep 27 '15 at 16:43
7
$\begingroup$

Indeed this is annoying. In my ~/.Mathematica/Kernel/init.m I have placed this removal code:

With[{dir = $HomeDirectory <> "/Wolfram Mathematica"},
  If[DirectoryQ[dir], DeleteDirectory[dir]]
]

Add the "Documents" part to the directory name in case yours is made there instead of in $HOME.

$\endgroup$
  • $\begingroup$ Instead of adding "Documents" manually to the path (if necessary), replace $HomeDirectory with $UserDocumentsDirectory. $\endgroup$ – Casimir Aug 24 '17 at 11:15
0
$\begingroup$

I ended up following the last solution suggested, that is, deleting the folder in the init file. Although it required a few minor modifications for it to work on Windows.

Specifically, Mathematica 11 on Windows 7 creates the folder MyDocuments\Wolfram Mathematica each time it starts, and I couldn't find a user-friendly way to modify or prevent this through the GUI in Preferences, which annoys the hell out of me.

As a simple workaround for Windows, consider editing

C:\ProgramData\Mathematica\Kernel\init.m

adding the command

With[{dir = $UserDocumentsDirectory <> "\\Wolfram Mathematica"}, If[DirectoryQ[dir], DeleteDirectory[dir]]]

to delete it automatically. Note the DOUBLE backslash as folder separator. Alternatively, use FileNameJoin.

Thanks to Darko Veberic for the suggestion.

$\endgroup$
  • $\begingroup$ Instead of double (back-)slashes you could also use FileNameJoin[{$UserDocumentsDirectory, "Wolfram Mathematica"}], which would pick the backslash automatically on Windows. $\endgroup$ – Ruslan Jan 29 '17 at 12:34

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.