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
ENHANCEMENT More advanced detection of whether outputPath is a parent of the project directory #4141
Conversation
re-running travis (which timed out do to something quirky) |
looks like a legit 0.10.x node failure:
@catbieber can you address https://github.com/ember-cli/ember-cli/pull/4141/files#r30938561 ? |
canDeleteOutputPath: function(outputPath) { | ||
return this.project.root.indexOf(outputPath) === -1; | ||
var rootPathParents = [this.project.root]; | ||
var parsedPath = path.parse(this.project.root); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require('path').parse
isn't something available in node 0.10.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, didn't realize that until I saw the failure this morning. Can probably rework using path.dirname() and path.sep instead. Plan to look at that either tonight or tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can backport the actual parse code into its own module? Might be the safest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can take a look...I'm really just using dir from the parsed path to make sure I get properly uniform and normalized paths (unfortunately path.normalize() wasn't cutting it, and that parents module that looked cool was also normalizing poorly, in a different way from path.normalize()) so path.dirname() might substitute just fine. If I have trouble with that, I'll look at backporting parse.
a85ccd3
to
9a50397
Compare
@stefanpenner It looks like tests are passing -- let me know if there are more improvements I should make to this patch. |
@catbieber thanks! This looks good :) |
ENHANCEMENT More advanced detection of whether outputPath is a parent of the project directory
Revision of: #4107
Updated tests so that OS-dependent paths (root, and relative paths) should work on *nix and Windows with the same code.