File tree Expand file tree Collapse file tree 3 files changed +24
-12
lines changed Expand file tree Collapse file tree 3 files changed +24
-12
lines changed Original file line number Diff line number Diff line change 1+ %% JAVA.FILESYSTEM_TYPE
2+ %
3+ % if stdlib.exists() was not adequate here, as on some CI systems, say Windows with Matlab
4+ % R2025a, despite the same setup on a laptop working.
5+ % stdlib.exists() was true, the Java function threw java.nio.file.NoSuchFileException.
6+ %
7+ % this try-catch is faster and more robust
8+
19function t = filesystem_type(file )
210
3- if stdlib .exists( file )
11+ try
412 t = char(java .nio .file .Files .getFileStore(javaPathObject(file )).type);
5- else
13+ catch
614 t = ' ' ;
715end
816
Original file line number Diff line number Diff line change 11%% JAVA.GET_OWNER get owner of file
2+ %
3+ %% JAVA.FILESYSTEM_TYPE
4+ %
5+ % if stdlib.exists() was not adequate here, as on some CI systems, say Windows with Matlab
6+ % R2025a, despite the same setup on a laptop working.
7+ % stdlib.exists() was true, the Java function threw java.nio.file.NoSuchFileException.
8+ %
9+ % this try-catch is faster and more robust
210
311function n = get_owner(p )
412
513% 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...)
614% https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/file/LinkOption.html
715
8- if stdlib .exists( p )
16+ try
917 opt = java .nio .file .LinkOption .values();
10- n = char(java .nio .file .Files .getOwner(javaPathObject(p ), opt ));
11- else
12- n = ' ' ;
13- end
14-
15- try % #ok<TRYNC>
16- n = string(n );
18+ n = string(java .nio .file .Files .getOwner(javaPathObject(p ), opt ));
19+ catch
20+ n = " " ;
1721end
1822
1923end
Original file line number Diff line number Diff line change @@ -126,14 +126,14 @@ function test_remove_file(tc)
126126
127127
128128function test_inode_device(tc , java_python_sys , id_name )
129- n = " stdlib. " + java_python_sys + " . " + id_name ;
129+
130130h = str2func(" stdlib." + id_name );
131- tc .assertNotEmpty(which(n ))
132131
133132try
134133 ip = h(pwd(), java_python_sys );
135134 tc .verifyClass(ip , ' uint64' )
136135 tc .verifyGreaterThan(ip , 0 )
136+
137137 tc .verifyEqual(h(" ." , java_python_sys ), ip )
138138catch e
139139 tc .verifyEqual(e .identifier , ' stdlib:hbackend:NameError' , e .message )
You can’t perform that action at this time.
0 commit comments