Improve searchPathFor

This commit is contained in:
Per Nordlöw 2021-09-25 01:47:13 +02:00
parent 3e2b615b8d
commit 52304683d7

View file

@ -1498,10 +1498,10 @@ package(std) string searchPathFor(scope const(char)[] executable)
@safe @safe
{ {
import std.algorithm.iteration : splitter; import std.algorithm.iteration : splitter;
import std.conv : text; import std.conv : to;
import std.path : chainPath; import std.path : chainPath;
string result; typeof(return) result;
environment.getImpl("PATH", environment.getImpl("PATH",
(scope const(char)[] path) (scope const(char)[] path)
@ -1514,7 +1514,7 @@ package(std) string searchPathFor(scope const(char)[] executable)
auto execPath = chainPath(dir, executable); auto execPath = chainPath(dir, executable);
if (isExecutable(execPath)) if (isExecutable(execPath))
{ {
result = text(execPath); result = execPath.to!(typeof(result));
return; return;
} }
} }