Skip to content

Commit

Permalink
actually use compiler path in stdlib detection now
Browse files Browse the repository at this point in the history
this is the actual rc.1 release now!
  • Loading branch information
WebFreak001 committed Nov 18, 2021
1 parent 0e9a736 commit b2e6c68
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions source/served/utils/stdlib_detect.d
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ string[] autoDetectStdlibPaths(string cwd = null, string compilerPath = null)
switch (binName)
{
case "dmd":
if (detectDMDStdlibPaths(cwd, ret))
if (detectDMDStdlibPaths(cwd, ret, compilerPath))
return ret;
break;
case "ldc":
case "ldc2":
if (detectLDCStdlibPaths(cwd, ret))
if (detectLDCStdlibPaths(cwd, ret, compilerPath))
return ret;
break;
case "gdc":
Expand Down Expand Up @@ -62,7 +62,7 @@ string[] autoDetectStdlibPaths(string cwd = null, string compilerPath = null)
}
}

bool detectDMDStdlibPaths(string cwd, out string[] ret)
bool detectDMDStdlibPaths(string cwd, out string[] ret, string dmdPath = null)
{
// https://dlang.org/dmd-linux.html#dmd-conf
// https://dlang.org/dmd-osx.html#dmd-conf
Expand All @@ -88,7 +88,9 @@ bool detectDMDStdlibPaths(string cwd, out string[] ret)
&& parseDmdConfImports(buildPath(home, confName), home, ret))
return true;

auto dmdPath = searchPathFor(dmdExe);
if (!dmdPath.length || !fs.exists(dmdPath))
dmdPath = searchPathFor(dmdExe);

if (dmdPath.length)
{
auto dmdDir = dirName(dmdPath);
Expand Down Expand Up @@ -141,7 +143,7 @@ bool detectDMDStdlibPaths(string cwd, out string[] ret)
}
}

bool detectLDCStdlibPaths(string cwd, out string[] ret)
bool detectLDCStdlibPaths(string cwd, out string[] ret, string ldcPath = null)
{
// https://github.com/ldc-developers/ldc/blob/829dc71114eaf7c769208f03eb9a614dafd789c3/driver/configfile.cpp

Expand All @@ -162,7 +164,9 @@ bool detectLDCStdlibPaths(string cwd, out string[] ret)
static immutable ldcExeAlt = "ldc";
}

auto ldcPath = searchPathFor(ldcExe);
if (!ldcPath.length || !fs.exists(ldcPath))
ldcPath = searchPathFor(ldcExe);

if (!ldcPath.length)
ldcPath = searchPathFor(ldcExeAlt);
auto ldcDir = ldcPath.length ? dirName(ldcPath) : null;
Expand Down

0 comments on commit b2e6c68

Please sign in to comment.