File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 11%% GET_OWNER owner of file or directory
2-
2+ %
3+ % %% Inputs
4+ % * p: path to examine
5+ % %% Outputs
6+ % * n: owner, or empty if path does not exist
37function n = get_owner(p )
48arguments
59 p (1 ,1 ) string
812% 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...)
913% https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/file/LinkOption.html
1014
15+ n = " " ;
16+ if ~stdlib .exists(p ), return , end
17+
1118op = javaPathObject(p );
1219opt = javaLinkOption();
1320
2027end
2128
2229% !assert(!isempty(get_owner(pwd)))
30+ % !assert(isempty(get_owner(tempname)))
Original file line number Diff line number Diff line change @@ -20,8 +20,11 @@ function test_filesystem_type(tc)
2020
2121function test_owner(tc )
2222owner = stdlib .get_owner(' .' );
23- L = strlength(owner );
24- tc .verifyGreaterThan(L , 0 , " expected non-empty username" )
23+ tc .verifyGreaterThan(strlength(owner ), 0 , " expected non-empty username" )
24+
25+ owner = stdlib .get_owner(tempname );
26+ tc .verifyEqual(strlength(owner ), 0 , " expected empty owner" )
27+
2528end
2629
2730
You can’t perform that action at this time.
0 commit comments