octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48221] prefdir should not be a private functi


From: Guillaume
Subject: [Octave-bug-tracker] [bug #48221] prefdir should not be a private function
Date: Wed, 15 Jun 2016 09:25:13 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0

Follow-up Comment #4, bug #48221 (project octave):

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.


## -*- texinfo -*-
## @deftypefn {} {} prefdir 
## @deftypefnx {} address@hidden =} prefdir 
## @deftypefnx {} address@hidden =} prefdir (1)
## Return the name of the directory containing Octave's preferences.
##
## @var{D} is a string containing the name of the directory containing
## Octave's preferences. The directory may or may not exist.
##
## If 1 is provided as an input, the preference directory is created if
## it does not yet exist.
##
## @seealso{addpref, getpref, setpref, ispref, rmpref}
## @end deftypefn

function retval = prefdir (varargin)

if ispc
  d = fullfile ('AppData', 'Roaming', 'Octave'); % or Documents\Octave
else
  d = '.octave';
endif

retval = fullfile (get_home_directory (), d, version ());

if (nargin ~= 0)
  if (isnumeric (varargin{1}) || islogical (varargin{1})) && ...
     numel (varargin{1}) == 1 && logical (varargin{1}))
    if ~exist (retval, 'dir')
      mkdir (retval);
    endif
  else
    error ('Input must be 1 to create the preference directory.');
  endif
endif

endfunction



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48221>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]