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

Fixed bugs relate to prevent copying to itself. #61

Closed
wants to merge 2 commits into from

Conversation

iwege
Copy link
Contributor

@iwege iwege commented Sep 25, 2014

I try to fix the issue #60, If I missed something , please let me know.

This PR refactoring the startsWith function and try to handle more situations. I add more testcases to test the different situations. * Some testcases can't used in Windows* :

  1. Copy to sub-folder
    1. src to src/out
  2. Copy to itself
    1. src to src
  3. Copy to the folder starts with src
    1. src to src_out
  4. Copy to the symlink folder
    1. src to src-symlink
  5. Copy the file to itself
    1. src/a to src/a
  6. More complex situations:
  7. src to src/src_out
  8. src to src_out/src

And I add mkdirp to devDependencies to create the directory easily.

rimraf(src_out, function(e) {
fs.mkdirSync(src_out);
rimraf(double_src_before_out, function() {
mkdirp.sync(double_src_before_out);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The double_src_before_out is similar to C:\source\C:\source_out. So it will block the whole testcase.
double_src_middle_out causes the same issue.

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.

1 participant