Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Windows directory separator now is backslash - wrong paths generated #410

Closed
e-oz opened this issue Oct 24, 2013 · 3 comments · Fixed by #445
Closed

Windows directory separator now is backslash - wrong paths generated #410

e-oz opened this issue Oct 24, 2013 · 3 comments · Fixed by #445

Comments

@e-oz
Copy link

e-oz commented Oct 24, 2013

Please switch directory separator under Windows to usual slash (/), Windows can easy work with it. Today I reinstalled yeoman and generator-angular and after adding directive got
"<script src="scripts/directives\randomBackground.js"></script>"
which is pretty ugly.
If there is any option where I can turn off this behavior - please let me know.

@pgilad
Copy link
Contributor

pgilad commented Nov 11, 2013

same problem here. i suspect it's a problem with path.join on windows:
the controller was generated using yo angular-generator:collector Employee

and the path that was injected to index.html as the script src was:
<script src="script\controllers\Employee.js"></script>

instead of:
<script src="script/controllers/Employee.js"></script>

I think the problem is here: (script-base.js)

Generator.prototype.generateSourceAndTest = function (appTemplate, testTemplate, targetDirectory, skipAdd) {
  this.appTemplate(appTemplate, path.join('scripts', targetDirectory, this.name));
  this.testTemplate(testTemplate, path.join(targetDirectory, this.name));
  if (!skipAdd) {
    this.addScriptToIndex(path.join(targetDirectory, this.name));
  }
};

@eddiemonge
Copy link
Member

Can you try this fix: https://github.com/eddiemonge/generator-angular/tree/webpath ?
The fix specifically is: https://github.com/eddiemonge/generator-angular/blob/webpath/script-base.js#L100 Update that line in your yeoman and if its good, I'll merge it in

@pgilad
Copy link
Contributor

pgilad commented Nov 12, 2013

Amazing... works wonders. You can merge the solution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants