Wed 15 Jun 2016 04:07:48 PM UTC, comment #6:
I fixed this on the default branch with the following simpler change:
http://hg.savannah.gnu.org/hgweb/octave/rev/e0952881e051
You can now call prefdir, and passing any argument to it will create the directory if it doesn't exist (tested with a bogus HOME variable).
This in no way guarantees that all preferences or settings related to Octave are actually stored in said directory, or that it can be safely removed to clean up all Octave preferences. That would be a separate, much larger undertaking.
|
Wed 15 Jun 2016 09:37:54 AM UTC, comment #5:
Sorry, there was a typo - new version below:
|
Wed 15 Jun 2016 09:25:13 AM UTC, comment #4:
Thanks for the feedbacks. It would be great to move prefdir.m from octave/scripts/prefs/private/ to octave/scripts/prefs/.
I still think it would also be an improvement to let the preference directory have its own folder (eg ~/.octave/ instead of ~/) in case, as Mike mentions, we end up storing more than a single file (Matlab seems to store many files there).
It is also possible that, on Windows, a file or folder starting with '.' is not allowed or recommended. I made a change to my proposed code - I'm just not sure what get_home_directory () returns on this platform.
|
Tue 14 Jun 2016 04:29:20 PM UTC, comment #3:
Yes, I am completely ignoring what the preferences directory or file actually are, and just thinking about supporting the syntax to create the directory. Granted in most cases the user's home directory will already exist, so it's a no-op, but maybe not all cases.
And maybe some day we will have a configuration directory that combines all settings for Octave, including installed packages, startup commands, prefs, and what are currently GUI preferences (using QSettings). There are other open bug reports about these things though.
|
Tue 14 Jun 2016 04:08:12 PM UTC, comment #2:
At some point Matlab may have moved this around. It is certainly dead simple to move it up from the private directory into the 'prefs' directory where it will be visible.
I don't know that we need to bother to support prefdir(1) syntax. Octave automatically creates the file '.octave_prefs' as necessary. Of course, we could always just document that you can call it that way.
Also, Octave supports preferences, but we support them in a UNIX way which is to have an rc file in the user's home directory. We don't use a separate folder, ~/.octave/, to hold that rc file.
|
Tue 14 Jun 2016 03:56:11 PM UTC, comment #1:
The linked page says "prefdir(1)" should create the directory. Does "prefdir(0)" also create it? Or "prefdir([])"?
|
Tue 14 Jun 2016 09:22:16 AM UTC, original submission:
At the moment, prefdir is implemented in scripts/prefs/private/prefdir.m and is therefore not accessible from the command line while it should be for Matlab compatibility, see:
http://www.mathworks.com/help/matlab/ref/prefdir.html
Before I noticed this file in Octave, I also implemented my own version that might provide a better compatibility with Matlab:
|