1 ## Copyright (C) 2012 John W. Eaton
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {@var{current_state}} recycle ()
21 ## @deftypefnx {Function File} {@var{old_state}} recycle (@var{new_state})
22 ## Query or set the preference for recycling deleted files.
24 ## Recycling files instead of permanently deleting them is currently not
25 ## implemented in Octave. To help avoid accidental data loss it
26 ## is an error to attempt enable file recycling.
32 function retval = recycle (state)
34 persistent current_state = "off";
40 if (nargin == 0 || nargout > 0)
41 retval = current_state;
46 if (strcmpi (state, "on"))
47 error ("recycle: recycling files is not implemented");
48 elseif (strcmpi (state, "off"))
49 current_state = "off";
51 error ("recycle: invalid value of STATE = `%s'", state);
54 error ("recycle: expecting STATE to be a character string");
60 %!error recycle ("on");
61 %!error recycle ("on", "and I mean it");
66 %! assert (recycle ("off"), "off");