Mercurial > octave
annotate scripts/miscellaneous/fileattrib.m @ 21568:3d60ed163b70
maint: Eliminate bad spacing around '='.
* Figure.h, PopupMenuControl.cc, annotation-dialog.cc, gl-select.h,
files-dock-widget.cc, find-files-dialog.cc, history-dock-widget.cc,
file-editor.cc, main-window.cc, webinfo.cc, resource-manager.cc,
shortcut-manager.cc, workspace-view.cc, __ichol__.cc, __ilu__.cc,
__lin_interpn__.cc, bitfcns.cc, debug.cc, filter.cc, ft-text-renderer.cc,
graphics.cc, graphics.in.h, hex2num.cc, jit-typeinfo.cc, load-save.cc,
ls-mat5.cc, mxarray.in.h, oct-stream.cc, pr-output.cc, variables.cc,
__init_fltk__.cc, __magick_read__.cc, chol.cc, ov-struct.cc, op-scm-cs.cc,
pt-assign.cc, CollocWt.cc, randpoisson.c, inputParser.m, quadgk.m, waitbar.m,
imwrite.m, __imread__.m, textread.m, fileattrib.m, __xzip__.m, what.m,
fsolve.m, fix_depends.m, stemleaf.m, bicgstab.m, ichol.m, io.tst:
maint: Eliminate bad spacing around '='.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 30 Mar 2016 22:09:26 -0700 |
parents | d1421f6fd518 |
children | bac0d6f07a3e |
rev | line source |
---|---|
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18857
diff
changeset
|
1 ## Copyright (C) 2005-2015 John W. Eaton |
5559 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5559 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5559 | 18 |
19 ## -*- texinfo -*- | |
21048
8bae5c3d4b30
fileattrib.m: Support Windows 7 and beyond (bug #46836).
Rik <rik@octave.org>
parents:
20937
diff
changeset
|
20 ## @deftypefn {} {} fileattrib (@var{file}) |
8bae5c3d4b30
fileattrib.m: Support Windows 7 and beyond (bug #46836).
Rik <rik@octave.org>
parents:
20937
diff
changeset
|
21 ## @deftypefnx {} {} fileattrib () |
8bae5c3d4b30
fileattrib.m: Support Windows 7 and beyond (bug #46836).
Rik <rik@octave.org>
parents:
20937
diff
changeset
|
22 ## @deftypefnx {} {[@var{status}, @var{msg}, @var{msgid}] =} fileattrib (@dots{}) |
5559 | 23 ## Return information about @var{file}. |
24 ## | |
21048
8bae5c3d4b30
fileattrib.m: Support Windows 7 and beyond (bug #46836).
Rik <rik@octave.org>
parents:
20937
diff
changeset
|
25 ## If successful, @var{status} is 1 and @var{msg} is a structure with the |
8bae5c3d4b30
fileattrib.m: Support Windows 7 and beyond (bug #46836).
Rik <rik@octave.org>
parents:
20937
diff
changeset
|
26 ## following fields: |
5559 | 27 ## |
28 ## @table @code | |
29 ## @item Name | |
30 ## Full name of @var{file}. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
31 ## |
5559 | 32 ## @item archive |
33 ## True if @var{file} is an archive (Windows). | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
34 ## |
5559 | 35 ## @item system |
36 ## True if @var{file} is a system file (Windows). | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
37 ## |
5559 | 38 ## @item hidden |
39 ## True if @var{file} is a hidden file (Windows). | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
40 ## |
5559 | 41 ## @item directory |
42 ## True if @var{file} is a directory. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
43 ## |
17170
d6499c14021c
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
44 ## @item UserRead |
5559 | 45 ## @itemx GroupRead |
46 ## @itemx OtherRead | |
20164
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
47 ## True if the user (group; other users) has read permission for @var{file}. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
48 ## |
17170
d6499c14021c
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
49 ## @item UserWrite |
5559 | 50 ## @itemx GroupWrite |
51 ## @itemx OtherWrite | |
20164
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
52 ## True if the user (group; other users) has write permission for @var{file}. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
53 ## |
17170
d6499c14021c
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
15007
diff
changeset
|
54 ## @item UserExecute |
5559 | 55 ## @itemx GroupExecute |
56 ## @itemx OtherExecute | |
20164
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
57 ## True if the user (group; other users) has execute permission for @var{file}. |
5559 | 58 ## @end table |
15007
8f0e3c5bfa5f
doc: Periodic grammarcheck of documentation
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
59 ## |
20164
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
60 ## If an attribute does not apply (i.e., archive on a Unix system) then the |
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
61 ## field is set to NaN. |
5559 | 62 ## |
21048
8bae5c3d4b30
fileattrib.m: Support Windows 7 and beyond (bug #46836).
Rik <rik@octave.org>
parents:
20937
diff
changeset
|
63 ## If @code{attrib} fails, @var{msg} is a non-empty string containing an |
8bae5c3d4b30
fileattrib.m: Support Windows 7 and beyond (bug #46836).
Rik <rik@octave.org>
parents:
20937
diff
changeset
|
64 ## error message and @var{msg_id} is the non-empty string @qcode{"fileattrib"}. |
8bae5c3d4b30
fileattrib.m: Support Windows 7 and beyond (bug #46836).
Rik <rik@octave.org>
parents:
20937
diff
changeset
|
65 ## |
20164
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
66 ## With no input arguments, return information about the current directory. |
5559 | 67 ## |
20164
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
68 ## If @var{file} contains globbing characters, return information about all |
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
69 ## the matching files. |
5559 | 70 ## @seealso{glob} |
71 ## @end deftypefn | |
72 | |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
73 function [status, msg, msgid] = fileattrib (file = ".") |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
74 |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
75 if (nargin > 1) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
76 print_usage (); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
77 endif |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
78 |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
79 if (! ischar (file)) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
80 error ("fileattrib: FILE must be a string"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
81 endif |
5559 | 82 |
83 status = true; | |
84 msg = ""; | |
85 msgid = ""; | |
86 | |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
87 files = glob (file); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
88 if (isempty (files)) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
89 files = {file}; |
5559 | 90 endif |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
91 nfiles = numel (files); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
92 |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
93 for i = [nfiles, 1:nfiles-1] # first time in loop extends the struct array |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
94 [info, err, msg] = stat (files{i}); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
95 if (! err) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
96 r(i).Name = canonicalize_file_name (files{i}); |
5559 | 97 |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
98 if (isunix ()) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
99 r(i).archive = NaN; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
100 r(i).system = NaN; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
101 r(i).hidden = NaN; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
102 else |
20928
2b8447888e0a
strip trailing whitespace from files
John W. Eaton <jwe@octave.org>
parents:
20852
diff
changeset
|
103 [~, attrib] = dos (sprintf ('attrib "%s"', r(i).Name)); |
21048
8bae5c3d4b30
fileattrib.m: Support Windows 7 and beyond (bug #46836).
Rik <rik@octave.org>
parents:
20937
diff
changeset
|
104 ## dos never returns error status so have to check it indirectly |
21049
ad9489d43ce9
fileattrib.m: Correct error detection pattern in cset 8bae5c3d4b30.
Rik <rik@octave.org>
parents:
21048
diff
changeset
|
105 if (! isempty (strfind (attrib, " -"))) |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
106 status = false; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
107 msgid = "fileattrib"; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
108 break; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
109 endif |
21076
b433f9990452
strip trailing whitespace from files
John W. Eaton <jwe@octave.org>
parents:
21049
diff
changeset
|
110 attrib = regexprep (attrib, '\S+:.*', ""); |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
111 r(i).archive = any (attrib == "A"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
112 r(i).system = any (attrib == "S"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
113 r(i).hidden = any (attrib == "H"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
114 endif |
5559 | 115 |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
116 r(i).directory = S_ISDIR (info.mode); |
5559 | 117 |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
118 modestr = info.modestr; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
119 r(i).UserRead = (modestr(2) == "r"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
120 r(i).UserWrite = (modestr(3) == "w"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
121 r(i).UserExecute = (modestr(4) == "x"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
122 if (isunix ()) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
123 r(i).GroupRead = (modestr(5) == "r"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
124 r(i).GroupWrite = (modestr(6) == "w"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
125 r(i).GroupExecute = (modestr(7) == "x"); |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21466
diff
changeset
|
126 r(i).OtherRead = (modestr(8) == "r"); |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
127 r(i).OtherWrite = (modestr(9) == "w"); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
128 r(i).OtherExecute = (modestr(10) == "x"); |
5559 | 129 else |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
130 r(i).GroupRead = NaN; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
131 r(i).GroupWrite = NaN; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
132 r(i).GroupExecute = NaN; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
133 r(i).OtherRead = NaN; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
134 r(i).OtherWrite = NaN; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
135 r(i).OtherExecute = NaN; |
5559 | 136 endif |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
137 else |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
138 status = false; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
139 msgid = "fileattrib"; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
140 break; |
5559 | 141 endif |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
142 endfor |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
143 |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
144 if (status) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
145 if (nargout == 0) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
146 status = r; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
147 else |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
148 msg = r; |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
149 endif |
5559 | 150 endif |
151 | |
152 endfunction | |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17170
diff
changeset
|
153 |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
154 |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
155 %!test |
21466
d1421f6fd518
fileattrib: Fix failing BIST test when P_tmpdir has trailing slash
Mike Miller <mtmiller@octave.org>
parents:
21076
diff
changeset
|
156 %! def_tmpdir = P_tmpdir (); |
d1421f6fd518
fileattrib: Fix failing BIST test when P_tmpdir has trailing slash
Mike Miller <mtmiller@octave.org>
parents:
21076
diff
changeset
|
157 %! while (length (def_tmpdir) > 2 && strfind (filesep ("all"), def_tmpdir(end))) |
d1421f6fd518
fileattrib: Fix failing BIST test when P_tmpdir has trailing slash
Mike Miller <mtmiller@octave.org>
parents:
21076
diff
changeset
|
158 %! def_tmpdir(end) = []; |
d1421f6fd518
fileattrib: Fix failing BIST test when P_tmpdir has trailing slash
Mike Miller <mtmiller@octave.org>
parents:
21076
diff
changeset
|
159 %! endwhile |
20928
2b8447888e0a
strip trailing whitespace from files
John W. Eaton <jwe@octave.org>
parents:
20852
diff
changeset
|
160 %! [status, attr] = fileattrib (P_tmpdir ()); |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
161 %! assert (status); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
162 %! assert (isstruct (attr)); |
20937
3b2cc6ef0624
use numfields (x) instead of numel (fieldnames (x))
John W. Eaton <jwe@octave.org>
parents:
20928
diff
changeset
|
163 %! assert (numfields (attr), 14); |
21466
d1421f6fd518
fileattrib: Fix failing BIST test when P_tmpdir has trailing slash
Mike Miller <mtmiller@octave.org>
parents:
21076
diff
changeset
|
164 %! assert (attr.Name, def_tmpdir); |
20836
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
165 %! assert (attr.directory); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
166 %! if (ispc ()) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
167 %! assert (! isnan (attr.archive)); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
168 %! else |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
169 %! assert (isnan (attr.archive)); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
170 %! endif |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
171 %! assert (attr.UserRead); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
172 %! if (ispc ()) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
173 %! assert (isnan (attr.GroupRead)); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
174 %! else |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
175 %! assert (! isnan (attr.GroupRead)); |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
176 %! endif |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
177 |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
178 %!error fileattrib (1, 2) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
179 %!error <FILE must be a string> fileattrib (1) |
ce8c465aa6a4
fileattrib.m: Overhaul file for greater Windows and Matlab compatibility.
Rik <rik@octave.org>
parents:
20711
diff
changeset
|
180 |