On 10 July 2013 11:24, Joseph Rushton Wakeling <joseph.wakel...@webdrake.net> wrote: > On 07/10/2013 02:07 AM, H. S. Teoh wrote: >> Comments / flames / pull requests welcome. ;-) > > string findGDC(string argv0) > { > // FIXME: this does not work 100% of the time. > auto c = match(baseName(argv0), `^(.*-)?g?dmd(-.*)?$`).captures; > auto targetPrefix = c[1]; > auto gdcDir = absolutePath(dirName(argv0)); > return buildNormalizedPath(gdcDir, targetPrefix ~ "gdc" ~ c[2]); > } > > The "obvious" solution is to have a gdmd.conf file which specifies what gdc > executable to use and where to find it. This should get round problems such > as > gdc being installed in /opt/gdc/bin and gdmd being in /usr/local/bin. >
Search all bin locations in $PATH for ./gdc - I'd imagine this is how Perl's FindBin works... -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';