-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
142 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,5 @@ function extract_zstd_bin(archive, out_dir) | |
untar(tar_arc, out_dir) | ||
delete(tar_arc) | ||
end | ||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ | |
rethrow(e) | ||
end | ||
end | ||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ | |
fsize = cell2mat({sds(i).Dims.Size}); | ||
|
||
end | ||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,5 @@ | |
names = string({ds.Name}); | ||
|
||
end | ||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,6 @@ | |
end | ||
|
||
end | ||
|
||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
%% HANDLE2FILENAME Convert a file handle to a filename | ||
|
||
function n = handle2filename(fileHandle) | ||
arguments | ||
fileHandle (1,1) {mustBeInteger} | ||
end | ||
% arguments | ||
% fileHandle (1,1) {mustBeInteger} | ||
% end | ||
|
||
mustBeInteger(fileHandle) | ||
|
||
n = ""; | ||
|
||
if fileHandle >= 0 | ||
n = stdlib.posix(string(fopen(fileHandle))); | ||
else | ||
n = string.empty; | ||
n = stdlib.posix(fopen(fileHandle)); | ||
end | ||
|
||
try %#ok<TRYNC> | ||
n = string(n); | ||
end | ||
|
||
end | ||
|
||
%!assert(handle2filename(0), "stdin") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ | |
end | ||
|
||
end | ||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
%% IS_REGULAR_FILE check if path is a regular file | ||
|
||
function isreg = is_regular_file(p) | ||
arguments | ||
p (1,1) string | ||
end | ||
|
||
opt = java.nio.file.LinkOption.values; | ||
function r = is_regular_file(p) | ||
% arguments | ||
% p (1,1) string | ||
% end | ||
|
||
% needs absolute() | ||
p = stdlib.absolute(p, "", false, true); | ||
|
||
isreg = java.nio.file.Files.isRegularFile(java.io.File(p).toPath(), opt); | ||
if stdlib.isoctave() | ||
opt = javaMethod("values", "java.nio.file.LinkOption"); | ||
op = javaObject("java.io.File", p).toPath(); | ||
r = javaMethod("isRegularFile", "java.nio.file.Files", op, opt); | ||
else | ||
opt = java.nio.file.LinkOption.values; | ||
op = java.io.File(p).toPath(); | ||
r = java.nio.file.Files.isRegularFile(op, opt); | ||
end | ||
|
||
end | ||
|
||
%!assert(is_regular_file('is_regular_file.m')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ | |
end | ||
|
||
end | ||
|
||
%!assert(len('abc'), 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,3 +52,5 @@ function ncsave(filename, varname, A, opts) | |
end | ||
|
||
end | ||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ | |
end | ||
|
||
end | ||
|
||
%!assert(ischar(null_file())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,3 +101,5 @@ | |
reader.close() | ||
|
||
end | ||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,3 +54,5 @@ | |
exe = string.empty; | ||
|
||
end | ||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,5 @@ | |
delete(fso); | ||
|
||
end | ||
|
||
%!testif 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
%% WINPATH2WSLPATH convert Windows path to WSL path | ||
% input format like \\wsl$\Ubuntu\home\username\... | ||
function wsl_path = winpath2wslpath(win_path) | ||
arguments | ||
win_path (1,1) string {mustBeNonzeroLengthText} | ||
end | ||
|
||
% arguments | ||
% win_path (1,1) string | ||
% end | ||
|
||
assert(stdlib.has_wsl(), "stdlib:sys:winpath2wslpath:EnvironmentError", mfilename() + "only supported on Windows Matlab with WSL") | ||
assert(stdlib.has_wsl(), "stdlib:sys:winpath2wslpath:EnvironmentError", "%s only supported on Windows Matlab with WSL", mfilename()) | ||
|
||
[stat, wsl_path] = system("wsl wslpath " + strrep(win_path, '\', '/')); | ||
|
||
assert(stat == 0, "stdlib:sys:winpath2wslpath:IOError", "could not convert wslpath " + wsl_path) | ||
assert(stat == 0, "stdlib:sys:winpath2wslpath:IOError", "could not convert wslpath %s", wsl_path) | ||
|
||
try %#ok<TRYNC> | ||
wsl_path = strip(wsl_path); | ||
end | ||
|
||
end | ||
|
||
%!test | ||
%! if stdlib.has_wsl() | ||
%! assert(ischar(winpath2wslpath("c:/users/"))) | ||
%! endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.