Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an EnsureDirectoryExists Alias to CreateDirectory and not fail if it exists #821

Closed
Redth opened this issue Apr 13, 2016 · 2 comments
Closed
Labels
Milestone

Comments

@Redth
Copy link
Contributor

Redth commented Apr 13, 2016

Currently using CreateDirectory ("./tmp") throws an error if it already exists.

I'm finding a lot of times I end up with this code in my scripts:

if (!DirectoryExists ("./tmp"))
    CreateDirectory ("./tmp");

It would be very helpful to have an alias that does this for us:

EnsureDirectoryExists ("./tmp");
Redth added a commit to Redth/cake that referenced this issue Apr 13, 2016
This is for cake-build#821

Simply wraps the `DirectoryExists` and `CreateDirectory` aliases to create a directory if it doesn't already exist.
@gitfool
Copy link
Contributor

gitfool commented Apr 14, 2016

I'm 'away from compiler' so I can't check, but ideally that should work for multiple levels of missing directories.

Redth added a commit to Redth/cake that referenced this issue May 17, 2016
Simply wraps the DirectoryExists and CreateDirectory aliases to create a directory if it doesn't already exist.

This PR supersedes cake-build#822
@devlead devlead added this to the v0.12.0 milestone May 17, 2016
@gep13
Copy link
Member

gep13 commented May 17, 2016

Fixed via 674420b

@gep13 gep13 closed this as completed May 17, 2016
@gep13 gep13 added Feature and removed Suggestion labels May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants