Skip to content

Check for existence of 'objs' directory and create one if it doesn't exist. - #63

Merged
MartinNowak merged 2 commits into
dlang:masterfrom
thekvs:master
Jun 2, 2013
Merged

MartinNowak merged 2 commits into
dlang:masterfrom
thekvs:master

Conversation

@thekvs

@thekvs thekvs commented Jun 1, 2013

Copy link
Copy Markdown
Contributor

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.

Comment thread rdmd.d Outdated

Copy link
Copy Markdown
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

thekvs commented Jun 1, 2013

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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