Skip to content

Commit 69af91c

Browse files
committed
absolute: don't coerce input
1 parent c2ba8d7 commit 69af91c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

+stdlib/absolute.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
function c = absolute(p, base, expand_tilde)
2020
arguments
21-
p (1,1) string
22-
base (1,1) string = ""
21+
p {mustBeTextScalar}
22+
base {mustBeTextScalar} = ''
2323
expand_tilde (1,1) logical = true
2424
end
2525

@@ -42,15 +42,19 @@
4242
end
4343

4444
if ~stdlib.is_absolute(b)
45-
b = strcat(pwd(), "/", b);
45+
b = strcat(pwd(), '/', b);
4646
end
4747

4848
b = stdlib.posix(b);
4949

5050
if strlength(c) == 0
5151
c = b;
5252
else
53-
c = strcat(b, "/", c);
53+
c = strcat(b, '/', c);
54+
end
55+
56+
if isstring(p)
57+
c = string(c);
5458
end
5559

5660
end

0 commit comments

Comments
 (0)