7017
|
1 ## Copyright (C) 2003, 2005, 2006, 2007 John W. Eaton |
4265
|
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 |
7016
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
4265
|
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 |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
4265
|
18 |
|
19 ## -*- texinfo -*- |
4350
|
20 ## @deftypefn {Function File} {@var{filename} =} fullfile (@var{dir1}, @var{dir2}, @dots{}, @var{file}) |
|
21 ## Return a complete filename constructed from the given components. |
5835
|
22 ## @seealso{fileparts} |
4265
|
23 ## @end deftypefn |
|
24 |
|
25 function filename = fullfile (varargin) |
|
26 |
|
27 if (nargin > 0) |
|
28 filename = varargin{1}; |
4683
|
29 if (length (filename) < 1) |
|
30 filename = "."; |
|
31 endif |
5595
|
32 if (strcmp (filename(end), filesep)) |
4265
|
33 filename(end) = ""; |
|
34 endif |
|
35 for i = 2:nargin |
|
36 tmp = varargin{i}; |
5595
|
37 if (strcmp (tmp(1), filesep)) |
4265
|
38 tmp(1) = ""; |
|
39 endif |
5595
|
40 if (i < nargin && strcmp (tmp(end), filesep)) |
4265
|
41 tmp(end) = ""; |
|
42 endif |
|
43 filename = strcat (filename, filesep, tmp); |
|
44 endfor |
|
45 else |
6046
|
46 print_usage (); |
4265
|
47 endif |
|
48 |
|
49 endfunction |