[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tempdir
From: |
John W. Eaton |
Subject: |
Re: tempdir |
Date: |
Wed, 30 Jan 2008 02:57:28 -0500 |
On 29-Jan-2008, Mats Hedlund wrote:
| John W. Eaton wrote:
| > On 28-Jan-2008, Mats Hedlund wrote:
| >
| > | Any reason for this difference when using tempdir;
| > |
| > | In matlab: /tmp/
| > | In octave: /tmp
| >
| > No one noticed before.
| >
| > And anyway, why should a directory separator be appended?
| >
| Maybe just for compatibility? Matlab is not consistent by any means,
| e.g. pwd returns the path without ending separator so why do they add it
| for tempdir? Annoying.
| For sure trivial thing, but anyway, just thought I let everyone know.
OK, whatever. I checked in the following change.
jwe
scripts/ChangeLog:
2008-01-30 John W. Eaton <address@hidden>
* miscellaneous/tempdir.m: Append filesep to name for
compatibility. Warn if not a directory or directory does not
exist.
Index: scripts/miscellaneous/tempdir.m
===================================================================
RCS file: /cvs/octave/scripts/miscellaneous/tempdir.m,v
retrieving revision 1.5
diff -u -u -r1.5 tempdir.m
--- scripts/miscellaneous/tempdir.m 12 Oct 2007 21:27:23 -0000 1.5
+++ scripts/miscellaneous/tempdir.m 30 Jan 2008 07:56:00 -0000
@@ -24,8 +24,16 @@
function dirname = tempdir ()
dirname = getenv ("TMPDIR");
- if (length (dirname) == 0)
+ if (isempty (dirname))
dirname = P_tmpdir;
endif
+ if (! strcmp (dirname(end), filesep))
+ strcat (dirname, filesep);
+ endif
+
+ if (! isdir (dirname))
+ warning ("tempdir: `%s' does not exist or is not a directory", dirname);
+ endif
+
endfunction
- tempdir, Mats Hedlund, 2008/01/28
- tempdir, John W. Eaton, 2008/01/29
- Re: tempdir, Mats Hedlund, 2008/01/29
- Re: tempdir,
John W. Eaton <=