Skip to content

Conversation

thekvs
Copy link
Contributor

@thekvs thekvs commented Jun 1, 2013

Discovered that when using with latest ldc2 compiler rdmd did not check for existence of directory for object files. This patch check for such a directory and creates one if it doesn't exist.

enforce(dryRun || objDirEntry.isDir,
"Entry `"~objDir~"' exists but is not a directory.");
}
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about the following instead?

if (exists(objDir))
{
    enforce(dryRun || isDir(objDir));
}
else
{
    mkdirRecurse(objDir);
}

@thekvs
Copy link
Contributor Author

thekvs commented Jun 1, 2013

I like your suggestion but on the other hand I've tried to be consistent with overall code style of the utility.

MartinNowak added a commit that referenced this pull request Jun 2, 2013
Check for existence of  'objs' directory and create one if it doesn't exist.
@MartinNowak MartinNowak merged commit a06de4a into dlang:master Jun 2, 2013
@CyberShadow
Copy link
Member

I like your suggestion but on the other hand I've tried to be consistent with overall code style of the utility.

It's not just about code style. Martin's suggested change results in two filesystem calls instead of one. The original code was better.

@MartinNowak
Copy link
Member

It's not just about code style. Martin's suggested change results in two filesystem calls instead of one. The original code was better.

It used exceptions for unexceptional code.
This is really an API issue of std.file. Also see #64 and Issue 10240.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants