Skip to content

Commit de2288e

Browse files
committed
remove redundant checks
1 parent 64c38e6 commit de2288e

File tree

4 files changed

+14
-22
lines changed

4 files changed

+14
-22
lines changed

+stdlib/device.m

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99

1010
i = [];
1111

12-
if stdlib.exists(path)
13-
if stdlib.isoctave()
14-
[s, err] = stat(path);
15-
if err == 0
16-
i = s.dev;
17-
end
18-
elseif stdlib.has_java() && stdlib.java_api() >= 11
19-
% Java 1.8 is buggy in some corner cases, so we require at least 11.
20-
i = java.nio.file.Files.getAttribute(javaPathObject(path), "unix:dev", javaLinkOption());
12+
if stdlib.isoctave()
13+
[s, err] = stat(path);
14+
if err == 0
15+
i = s.dev;
2116
end
17+
elseif isunix() && stdlib.has_java() && stdlib.java_api() >= 11
18+
% Java 1.8 is buggy in some corner cases, so we require at least 11.
19+
i = java.nio.file.Files.getAttribute(javaPathObject(path), "unix:dev", javaLinkOption());
2220
end
2321

2422
end

+stdlib/filesystem_type.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
p {mustBeTextScalar} = ''
1212
end
1313

14-
assert(stdlib.exists(p), "Path does not exist: %s", p);
15-
1614
op = javaPathObject(p);
1715

1816
if stdlib.isoctave()

+stdlib/get_owner.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
% 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...)
1414
% https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/nio/file/LinkOption.html
1515

16-
assert(stdlib.exists(p), "Path %s does not exist.", p)
17-
1816
op = javaPathObject(p);
1917
opt = javaLinkOption();
2018

+stdlib/inode.m

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99

1010
i = [];
1111

12-
if stdlib.exists(path)
13-
if stdlib.isoctave()
14-
[s, err] = stat(path);
15-
if err == 0
16-
i = s.ino;
17-
end
18-
elseif stdlib.has_java() && stdlib.java_api() >= 11
19-
% Java 1.8 is buggy in some corner cases, so we require at least 11.
20-
i = java.nio.file.Files.getAttribute(javaPathObject(path), "unix:ino", javaLinkOption());
12+
if stdlib.isoctave()
13+
[s, err] = stat(path);
14+
if err == 0
15+
i = s.ino;
2116
end
17+
elseif isunix() && stdlib.has_java() && stdlib.java_api() >= 11
18+
% Java 1.8 is buggy in some corner cases, so we require at least 11.
19+
i = java.nio.file.Files.getAttribute(javaPathObject(path), "unix:ino", javaLinkOption());
2220
end
2321

2422
end

0 commit comments

Comments
 (0)