Skip to content

Commit 6acba74

Browse files
committed
absolute: simpliy greatly
1 parent bcaa0f0 commit 6acba74

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

+stdlib/absolute.m

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,12 @@
2121
base {mustBeTextScalar} = pwd()
2222
end
2323

24-
c = p;
25-
if stdlib.is_absolute(c)
26-
return
24+
if stdlib.is_absolute(p)
25+
c = p;
26+
return
2727
end
2828

29-
if ~strempty(base)
30-
b = stdlib.absolute(base);
31-
else
32-
b = pwd();
33-
end
34-
35-
if ~strempty(c)
36-
c = fullfile(b, c);
37-
else
38-
c = b;
39-
end
40-
41-
if isstring(p) || isstring(base)
42-
c = string(c);
43-
end
29+
c = fullfile(stdlib.absolute(base), p);
4430

4531
end
4632

+stdlib/stem.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
%% STEM filename without directory or suffix
1+
%% STEM file name without directory or suffix
22

33
function st = stem(p)
44
arguments
@@ -8,6 +8,7 @@
88
[~, n, s] = fileparts(p);
99

1010
if strempty(n)
11+
% leading dot filename
1112
st = s;
1213
else
1314
st = n;

0 commit comments

Comments
 (0)