Skip to content

Commit bbf9f14

Browse files
committed
hard_link_count: octave stat()
1 parent c6506f0 commit bbf9f14

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

+stdlib/hard_link_count.m

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,17 @@
1010
p (1,1) string
1111
end
1212

13-
if ispc || stdlib.is_url(p) || ~isfile(p)
14-
c = [];
15-
return
16-
end
17-
18-
op = javaPathObject(p);
19-
opt = javaLinkOption();
13+
c = [];
2014

2115
if stdlib.isoctave()
22-
c = javaMethod("getAttribute", "java.nio.file.Files", op, "unix:nlink", opt);
16+
s = stat(p);
17+
if ~isempty(s)
18+
c = s.nlink;
19+
end
20+
elseif ispc || ~isfile(p)
21+
return
2322
else
24-
c = java.nio.file.Files.getAttribute(op, "unix:nlink", opt);
23+
c = java.nio.file.Files.getAttribute(javaPathObject(p), "unix:nlink", javaLinkOption());
2524
end
2625

2726
end

0 commit comments

Comments
 (0)