Skip to content

Commit 7994491

Browse files
committed
is_exe: don't coerce
1 parent a05c6aa commit 7994491

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

+stdlib/+native/has_windows_executable_suffix.m

Lines changed: 0 additions & 14 deletions
This file was deleted.

+stdlib/is_exe.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@
99
% this method is like 40x faster than native.
1010

1111
function y = is_exe(file)
12-
arguments
13-
file (1,1) string
14-
end
1512

1613
y = false;
1714

18-
if ispc() && ~stdlib.native.has_windows_executable_suffix(file)
15+
if ispc() && ~has_windows_executable_suffix(file)
1916
return
2017
end
2118

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function i = has_windows_executable_suffix(file)
2+
3+
pec = getenv("PATHEXT");
4+
if isempty(pec)
5+
pec = '.COM;.EXE;.BAT;.CMD;';
6+
end
7+
pe = split(string(pec), pathsep);
8+
9+
i = endsWith(stdlib.suffix(file), pe, 'IgnoreCase', true);
10+
11+
end

0 commit comments

Comments
 (0)