gcc 4.8.1 made it to Debian Sid

eles eles at eles.com
Wed Jul 10 05:14:37 PDT 2013


On Wednesday, 10 July 2013 at 12:03:06 UTC, eles wrote:
> On Wednesday, 10 July 2013 at 10:24:17 UTC, Joseph Rushton 
> Wakeling 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]);
>>    }

Quick and unportable (Linux-only) drop-in replacement:

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 which = executeShell("which gdc");
	if (which.status == 0){
		writeln("Failed to execute which.");
	}
	else {
		writefln("which returned %s", which.output);
	}
	
	auto gdcDir = absolutePath(dirName(which.output));
	writefln("new findGDC: gdcDir=%s", gdcDir);
     return buildNormalizedPath(gdcDir, targetPrefix ~ "gdc" ~ 
c[2]);
}


More information about the D.gnu mailing list