Mercurial > jwe > octave
changeset 22511:1e81abd0314a
tempname: respect the value of $TMPDIR if set, be consistent with tempdir
* file-io.cc (Ftempname): Default to creating files in $TMPDIR when called
without a directory argument.
* unpack.m: Update BIST test to unpack files in tempdir, which may differ from
P_tmpdir.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Fri, 16 Sep 2016 15:36:26 -0700 |
parents | 00bf2e2de581 |
children | 549f8625a61b |
files | libinterp/corefcn/file-io.cc scripts/miscellaneous/unpack.m |
diffstat | 2 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/file-io.cc Fri Sep 09 18:26:40 2016 +0200 +++ b/libinterp/corefcn/file-io.cc Fri Sep 16 15:36:26 2016 -0700 @@ -2751,6 +2751,8 @@ if (nargin > 0) dir = args(0).xstring_value ("tempname: DIR must be a string"); + else + dir = octave::sys::env::getenv ("TMPDIR"); std::string pfx ("oct-");
--- a/scripts/miscellaneous/unpack.m Fri Sep 09 18:26:40 2016 +0200 +++ b/scripts/miscellaneous/unpack.m Fri Sep 16 15:36:26 2016 -0700 @@ -318,7 +318,7 @@ %! copyfile (filename, [filename ".orig"]); %! gzip (filename, dirname); %! [~, f] = fileparts (filename); -%! filelist = unpack (fullfile (dirname, [f ".gz"]), P_tmpdir); +%! filelist = unpack (fullfile (dirname, [f ".gz"]), tempdir); %! assert (filelist{1}, filename); %! fid = fopen ([filename ".orig"], "rb"); %! assert (fid >= 0);