Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

copyDirSyncRecursive just deleted my whole project #50

Closed
ricardograca opened this issue Jan 25, 2013 · 9 comments
Closed

copyDirSyncRecursive just deleted my whole project #50

ricardograca opened this issue Jan 25, 2013 · 9 comments

Comments

@ricardograca
Copy link

I was trying to copy some files to the root of my project and copyDirSyncRecursive deleted my whole project. Permanently. Forever. Git directory included. Thanks for that. What I mean is that deleting the target directory should never be the default. That's not how OS copy functions work.

@stephanebachelier
Copy link

I agree with this comment. The copyDirSyncRecursive should stop and warn about existiing directory it may delete. Or it should give an option to merge.

A warning message may be important anyway.

@ryanmcgrath
Copy link
Owner

You're both right, and I'm a sucker for having to put this off for the past few months. I won't blame you if you moved on to using other libraries, but for what it's worth it should be fixed now. Errors should get thrown/returned if the directory already exists and the user hasn't specified that it should be force deleted.

Thanks for filing this issue, sorry about the delay!

@stephanebachelier
Copy link

Glad you've made it.
You're not a sucker :) Your library is helpful and it's open source software.

@ricardograca
Copy link
Author

Many thanks! :D

tschaub added a commit to tschaub/packajs that referenced this issue May 9, 2013
Avoiding test failures by copying into a non-existent directory (see ryanmcgrath/wrench-js#50).
@rabchev
Copy link

rabchev commented Jul 2, 2013

Now preserveFiles option is broken.

@rabchev
Copy link

rabchev commented Jul 2, 2013

Sorry my bad, it works fine.

@rabchev
Copy link

rabchev commented Jul 2, 2013

:) Sorry again, actually it doesn't work, I was confused. preserveFiles is really broken.

@t-ruas
Copy link

t-ruas commented Oct 21, 2013

You should remove that "return new Error" line (why not throw btw?) when forceDelete isn't used and just let it merge into target directory.

@ryanmcgrath
Copy link
Owner

return vs throw, yeah, good call.

As far as merging... I don't see that as predictable behavior. That's not really default behavior, is it?

vojtatranta pushed a commit to vojtatranta/grunt-suppe that referenced this issue Apr 28, 2015
ryanmcgrath/wrench-js#50
As result, copied project failed on compilation with base.js not found
message
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants