Skip to content

Commit 1250bc4

Browse files
committed
restore prior drop_slash
1 parent f80bc60 commit 1250bc4

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

+stdlib/canonical.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
end
4343
end
4444

45-
c =stdlib.posix(c);
45+
c = stdlib.posix(c);
4646

4747
if ~strlength(c)
4848
c = stdlib.normalize(e);

+stdlib/drop_slash.m

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,25 @@
88
p {mustBeTextScalar}
99
end
1010

11+
s = stdlib.posix(p);
12+
13+
uncslash = ispc() && startsWith(s, '//');
14+
1115
% drop repeated slashes inside string
12-
d = regexprep(char(p), '/+', '/');
16+
d = regexprep(s, '/+', '/');
17+
18+
L = strlength(d);
1319

14-
% drop trailing slash "/" or "\", but preserve a single slash if that's the only character
15-
while strlength(d) > 1 && endsWith(d, {'/', '\'})
16-
d = d(1:end-1);
20+
if L < 2
21+
if uncslash
22+
d = '//';
23+
end
24+
elseif ~ispc() || (L ~= 3 || ~strcmp(d, stdlib.root(s)))
25+
d = regexprep(d, '/$', '');
1726
end
1827

19-
if ispc() && ~isempty(d) && strcmp(d, stdlib.root_name(p))
20-
d = strcat(d, '/');
28+
if uncslash
29+
d = strcat('/', d);
2130
end
2231

2332
if isstring(p)

Readme_java.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ If desired (not used by Matlab-stdlib), one can use non-factory Java classes in
4343
and
4444
[GNU Octave](https://docs.octave.org/interpreter/Making-Java-Classes-Available.html).
4545

46-
4746
## Configure Matlab JVM
4847

4948
The Matlab Java interface is like other Matlab external languages such as Python.

0 commit comments

Comments
 (0)