Mercurial > octave
annotate scripts/miscellaneous/tempdir.m @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | 7854d5752dd2 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
3 ## Copyright (C) 2003-2022 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
4266 | 7 ## |
8 ## This file is part of Octave. | |
9 ## | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
4266 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
4266 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
4266 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
4266 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
27 ## @deftypefn {} {@var{dir} =} tempdir () |
19210
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
28 ## Return the name of the host system's directory for temporary files. |
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
29 ## |
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
30 ## The directory name is taken first from the environment variable |
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
31 ## @env{TMPDIR}. If that does not exist the system default returned by |
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
32 ## @code{P_tmpdir} is used. |
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
33 ## @seealso{P_tmpdir, tempname, mkstemp, tmpfile} |
4266 | 34 ## @end deftypefn |
35 | |
36 function dirname = tempdir () | |
37 | |
38 dirname = getenv ("TMPDIR"); | |
7430 | 39 if (isempty (dirname)) |
28892
3cac3ceb9629
maint: Use coding style with parentheses after function name to distinguish from a variable.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
40 dirname = P_tmpdir (); |
4266 | 41 endif |
42 | |
7430 | 43 if (! strcmp (dirname(end), filesep)) |
16994
333243133364
Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents:
15466
diff
changeset
|
44 dirname = [dirname filesep]; |
7430 | 45 endif |
46 | |
25781
e04c56bbbace
isdir.m: Make m-file a legacy function (bug #54489)
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
47 if (! isfolder (dirname)) |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
48 warning ("tempdir: '%s' does not exist or is not a directory", dirname); |
7430 | 49 endif |
50 | |
4266 | 51 endfunction |
13072
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
52 |
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
53 |
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
54 %!assert (ischar (tempdir ())) |
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
55 |
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
56 %!test |
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
57 %! old_wstate = warning ("query"); |
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
58 %! warning ("off"); |
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
59 %! old_tmpdir = getenv ("TMPDIR"); |
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
60 %! unwind_protect |
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
61 %! setenv ("TMPDIR", "__MY_TMP_DIR__"); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
13072
diff
changeset
|
62 %! assert (tempdir (), ["__MY_TMP_DIR__" filesep()]); |
13072
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
63 %! unwind_protect_cleanup |
19210
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 %! if (! isempty (old_tmpdir)) |
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 %! setenv ("TMPDIR", old_tmpdir); |
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 %! else |
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
67 %! unsetenv ("TMPDIR"); |
841d8f606bcd
doc: Improve docstrings for tempname, tempdir family of functions.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
68 %! endif |
13072
39814ef3278b
codesprint: Add tests for tempdir
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
69 %! warning (old_wstate); |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
13072
diff
changeset
|
70 %! end_unwind_protect |