Skip to content

Commit 46c3765

Browse files
committed
get_owner: java fcn
1 parent da96ef6 commit 46c3765

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

+stdlib/+java/get_owner.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function n = get_owner(p)
2+
3+
% https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/file/Files.html#getOwner(java.nio.file.Path,java.nio.file.LinkOption...)
4+
% https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/file/LinkOption.html
5+
6+
try
7+
opt = javaMethod("values", "java.nio.file.LinkOption");
8+
9+
n = javaMethod("getOwner", "java.nio.file.Files", javaPathObject(p), opt);
10+
catch e
11+
warning(e.identifier, "%s", e.message)
12+
n = string.empty;
13+
end
14+
15+
end

+stdlib/get_owner.m

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515
if ~ispc() && stdlib.has_python()
1616
n = stdlib.python.get_owner(p);
1717
elseif stdlib.has_java()
18-
% https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/file/Files.html#getOwner(java.nio.file.Path,java.nio.file.LinkOption...)
19-
% https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/file/LinkOption.html
20-
21-
opt = javaMethod("values", "java.nio.file.LinkOption");
22-
23-
n = javaMethod("getOwner", "java.nio.file.Files", javaPathObject(p), opt).toString();
24-
% .toString() needed for Octave
18+
n = stdlib.java.get_owner(p);
2519
end
2620

2721
if strempty(n)

0 commit comments

Comments
 (0)