Skip to content

Commit 856a87f

Browse files
committed
unlink => remove
1 parent 3a57fea commit 856a87f

File tree

7 files changed

+22
-20
lines changed

7 files changed

+22
-20
lines changed

+stdlib/is_mex_fun.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
function y = is_mex_fun(name)
44
y = endsWith(which(name), mexext());
5-
end
5+
end
6+
7+
%!testif 0

+stdlib/unlink.m renamed to +stdlib/remove.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
%% UNLINK delete file or empty directory
1+
%% REMOVE delete file or empty directory
22
% optional: mex
33
%
44
% Matlab or GNU Octave delete() has trouble with not being able to delete
55
% open files on Windows. This function overcomes that limitation by returning
66
% a boolean success status.
77

8-
function ok = unlink(apath)
8+
function ok = remove(apath)
99
arguments
1010
apath {mustBeTextScalar}
1111
end

+stdlib/resolve.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
end
1919

20-
%!assert (resolve(''), stdlib.posix(pwd()))
20+
%!testif 0

buildfile.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ function build_exe(context)
207207

208208
srcs = {
209209
"src/is_absolute.cpp", ...
210-
"src/unlink.cpp", ...
210+
"src/remove.cpp", ...
211211
["src/is_admin.cpp", "src/admin_fs.cpp"] ...
212212
"src/is_char_device.cpp", ...
213213
["src/normalize.cpp", normal], ...

octave_build.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function octave_build(overwrite)
2424
};
2525

2626
% need this for loop below
27-
unlink_bin = fullfile(t, "unlink.oct");
28-
if ~isfile(unlink_bin)
29-
mkoctfile(fullfile(d, "unlink.cpp"), ["-I", inc], "--output", unlink_bin)
27+
remove_bin = fullfile(t, "remove.oct");
28+
if ~isfile(remove_bin)
29+
mkoctfile(fullfile(d, "remove.cpp"), ["-I", inc], "--output", remove_bin)
3030
end
3131

3232
%% build C+ Octave
@@ -41,7 +41,7 @@ function octave_build(overwrite)
4141

4242
disp(["mkoctfile: ", src, " => ", bin])
4343
if isfile(bin)
44-
assert(stdlib.unlink(bin))
44+
assert(stdlib.remove(bin))
4545
end
4646
mkoctfile(src, ["-I", inc], "--output", bin)
4747
end

src/octave/unlink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <filesystem>
55

66

7-
DEFUN_DLD (unlink, args, nargout,
7+
DEFUN_DLD (remove, args, nargout,
88
"delete file or empty directory")
99
{
1010
if (args.length() != 1){

test/TestMex.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,36 @@ function test_is_admin(tc)
2424
end
2525

2626

27-
function test_unlink_file(tc)
28-
tc.assumeTrue(isfile(fileparts(mfilename("fullpath")) + "/../+stdlib/unlink." + mexext))
27+
function test_remove_file(tc)
28+
tc.assumeTrue(isfile(fileparts(mfilename("fullpath")) + "/../+stdlib/remove." + mexext))
2929

3030
d = tc.createTemporaryFolder();
3131

3232
f = tempname(d);
3333

34-
tc.verifyFalse(stdlib.unlink(f), "should not succeed at unlinking non-existant path")
34+
tc.verifyFalse(stdlib.remove(f), "should not succeed at removing non-existant path")
3535

3636
tc.assumeTrue(stdlib.touch(f))
37-
tc.verifyTrue(stdlib.unlink(f), "failed to unlink file")
37+
tc.verifyTrue(stdlib.remove(f), "failed to remove file")
3838
end
3939

4040

41-
function test_unlink_empty_dir(tc)
42-
tc.assumeTrue(isfile(fileparts(mfilename("fullpath")) + "/../+stdlib/unlink." + mexext))
41+
function test_remove_empty_dir(tc)
42+
tc.assumeTrue(isfile(fileparts(mfilename("fullpath")) + "/../+stdlib/remove." + mexext))
4343

4444
d = tc.createTemporaryFolder();
4545

46-
tc.verifyTrue(stdlib.unlink(d), "failed to unlink empty directory")
46+
tc.verifyTrue(stdlib.remove(d), "failed to remove empty directory")
4747
end
4848

4949

50-
function test_unlink_recursive(tc)
51-
tc.assumeTrue(isfile(fileparts(mfilename("fullpath")) + "/../+stdlib/unlink." + mexext))
50+
function test_remove_recursive(tc)
51+
tc.assumeTrue(isfile(fileparts(mfilename("fullpath")) + "/../+stdlib/remove." + mexext))
5252

5353
d = tc.createTemporaryFolder();
5454

5555
tc.assumeTrue(stdlib.touch(fullfile(d, "junk.txt")))
56-
tc.verifyFalse(stdlib.unlink(d), "should not unlink directory recursively")
56+
tc.verifyFalse(stdlib.remove(d), "should not remove directory recursively")
5757
end
5858

5959
end

0 commit comments

Comments
 (0)