Mercurial > octave
comparison scripts/miscellaneous/mkdir.m @ 28062:4563c23597dd
mkdir.m: Don't return status when no output requested (bug #57799).
* mkdir.m: Call subfunction mkdir_recur, but store the status result in
temporary variable "sts". If no outputs are requested (nargout == 0)
then check "sts" and issue an error if operation failed. If output
requested then assign output "status" the value of "sts".
author | Rik <rik@octave.org> |
---|---|
date | Fri, 14 Feb 2020 07:31:16 -0800 |
parents | bd51beb6205e |
children | 977793472fc9 |
comparison
equal
deleted
inserted
replaced
28061:8f5e625062f3 | 28062:4563c23597dd |
---|---|
67 endif | 67 endif |
68 | 68 |
69 ## Move leading directory names from dirname to parent | 69 ## Move leading directory names from dirname to parent |
70 [parent, dirname, ext] = fileparts ([parent, dirname]); | 70 [parent, dirname, ext] = fileparts ([parent, dirname]); |
71 | 71 |
72 [status, msg, msgid] = mkdir_recur (parent, [dirname, ext]); | 72 [sts, msg, msgid] = mkdir_recur (parent, [dirname, ext]); |
73 | |
74 if (nargout == 0) | |
75 if (! sts) | |
76 error ("mkdir: failed to create directory"); | |
77 endif | |
78 else | |
79 status = sts; | |
80 endif | |
73 | 81 |
74 endfunction | 82 endfunction |
75 | 83 |
76 ## Recursively make directories until parent/dirname can be created. | 84 ## Recursively make directories until parent/dirname can be created. |
77 function [status, msg, msgid] = mkdir_recur (parent, dirname) | 85 function [status, msg, msgid] = mkdir_recur (parent, dirname) |