Skip to content

Commit 7251dad

Browse files
committed
add filesystem_type()
1 parent c07c77c commit 7251dad

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

+stdlib/+fileio/filesystem_type.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function t = filesystem_type(p)
2+
arguments
3+
p (1,1) string
4+
end
5+
6+
import java.io.File
7+
import java.nio.file.Files
8+
9+
t = string(Files.getFileStore(File(p).toPath()).type());
10+
11+
end

+stdlib/filesystem_type.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function t = filesystem_type(p)
2+
arguments
3+
p (1,1) string
4+
end
5+
6+
t = stdlib.fileio.filesystem_type(p);
7+
end

test/TestFileImpure.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,17 @@ function test_hash(tc)
275275

276276
end
277277

278+
279+
function test_filesystem_type(tc)
280+
281+
import matlab.unittest.constraints.IsOfClass
282+
283+
t = stdlib.filesystem_type(".");
284+
285+
tc.verifyThat(t, IsOfClass('string'))
286+
287+
end
288+
278289
end
279290

280291
end

0 commit comments

Comments
 (0)