Behavior of 'mkdir'
John W. Eaton
jwe at bevo.che.wisc.edu
Thu Jul 24 12:08:38 CDT 2008
On 24-Jul-2008, WMennerich wrote:
| But another thing which could increase the Octave/Matlab compatiblility:
|
| The message string of the mkdir-function differs in the discussed case:
|
| Matlab wrotes: 'Directory already exists.' (also with the point at the end)
|
| Octave wrotes: 'File exists'
|
| I would suggest to fit the message string given back by the octave mkdir to
| the output which comes from matlab to make strcmp-constructs more compatible
| between Matlab and Octave. Also because 'File exists' may be
| misleading: Sure, in UnixU/Linux everything is a 'file', also directories.
| But since
| the name of this function is 'mkdir' and not 'mkfile' or something else, the
| message should have a relation to 'directory'.
I have no desire to change error messages so that they match exactly
the Matlab error messages (you would do that, but not change the
behavior of the mkdir function?).
In Octave, this message comes from the C-level strerror function.
The text is system dependent. If Octave is modified to support
different locale settings, then the message will change if you change
your locale setting to another language. So I think checking the
text to decide what to do is probably not a good programming strategy.
I think it might be best to simply change the behavior to match
Matlab's in this case. However, I don't think that we need to
duplicate the behavior exactly. I see that Matlab also returns
status=1 and msg="Directory already exists." when the "directory" is
just a regular file. That is probably not a good thing to do. How
about the attached patch?
jwe
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080724/bbcbfce7/attachment.ksh
More information about the Octave-maintainers
mailing list