Mercurial > hg > octave-nkf
annotate scripts/path/pathdef.m @ 9245:16f53d29049f
update copyright notices
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 22 May 2009 10:46:00 -0400 |
parents | fca0dc2fb042 |
children | 9f25290a35e8 |
rev | line source |
---|---|
9245 | 1 ## Copyright (C) 2008, 2009 Ben Abbott |
7388 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
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. | |
9 ## | |
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. | |
14 ## | |
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/>. | |
18 | |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Function File} {@var{val} =} pathdef () | |
21 ## Return the default path for Octave. | |
22 ## The path information is extracted from one of three sources. | |
23 ## In order of preference, those are; | |
24 ## | |
25 ## @enumerate | |
26 ## @item @file{~/.octaverc} | |
9038
fca0dc2fb042
Cleanup documentation files stmt.texi and func.texi
Rik <rdrider0-list@yahoo.com>
parents:
7393
diff
changeset
|
27 ## @item @file{<octave-home>/@dots{}/<version>/m/startup/octaverc} |
7392 | 28 ## @item Octave's path prior to changes by any octaverc. |
7388 | 29 ## @end enumerate |
30 ## @seealso{path, addpath, rmpath, genpath, savepath, pathsep} | |
31 ## @end deftypefn | |
32 | |
33 function val = pathdef () | |
34 | |
7392 | 35 ## Locate the site octaverc file. |
7391 | 36 pathdir = octave_config_info ("localstartupfiledir"); |
7392 | 37 site_octaverc = fullfile (pathdir, "octaverc"); |
7388 | 38 |
7393 | 39 ## Locate the user ~\.octaverc file. |
7392 | 40 user_octaverc = fullfile ("~", ".octaverc"); |
7388 | 41 |
7391 | 42 ## Extract the specified paths from the site and user octaverc"s. |
7393 | 43 site_path = __extractpath__ (site_octaverc); |
7392 | 44 if (exist (user_octaverc, "file")) |
7393 | 45 user_path = __extractpath__ (user_octaverc); |
7388 | 46 else |
7393 | 47 user_path = ""; |
7388 | 48 endif |
49 | |
7392 | 50 ## A path definition in the user octaverc has precedence over the |
51 ## site. | |
52 | |
7393 | 53 if (! isempty (user_path)) |
54 val = user_path; | |
55 elseif (! isempty (site_path)) | |
56 val = site_path; | |
57 else | |
58 val = __pathorig__ (); | |
7388 | 59 endif |
60 | |
61 endfunction |