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

Build Task fails on windows due to OS separator #22

Closed
lmarkus opened this issue Jan 5, 2014 · 10 comments
Closed

Build Task fails on windows due to OS separator #22

lmarkus opened this issue Jan 5, 2014 · 10 comments
Labels

Comments

@lmarkus
Copy link
Contributor

lmarkus commented Jan 5, 2014

Looks like Grunt expands patterns like **/*.dust and **\\*.dustwith no regard to the host OS path separator. It's always a /

Under Windows, this causes issues with the following code:

Proper solution: Find a way for the globbing to respect the OS separator.

Very ugly workaround 💩 : Assume that everything works with /. Don't like the brittleness of this and would only use it as a last resort.

@lmarkus
Copy link
Contributor Author

lmarkus commented Jan 5, 2014

Grunt uses minimatch.

minimatch says no to backslashes:
https://github.com/isaacs/minimatch/blob/master/minimatch.js#L147

  if (platform === "win32") {
    pattern = pattern.split("\\").join("/")
  }

@alexsantos
Copy link
Contributor

I've been doing some tests on windows and found this:

The findCommonRoot function in fileutil is getting a list of files with the separator '/' but uses the separator from path.sep, which is '' on Windows. If you hardcode it to '/' it works well.

@alexsantos
Copy link
Contributor

I've been looking at this issue and have been able to compile the index.dust and the layouts/master.dust templates but not the errors/*.dust templates.
Grunt uses always a slash as a dir separator has @lmarkus noted above, even on Windows but the path module uses the separator from the OS and when on Windows, it automatically changes the slash to backslashes, which causes a big mess.
What I've done was look for the places where it is changing to backslashes and turn into slash and only use backslashes when there is some file read.

@alexsantos
Copy link
Contributor

@lmarkus I can now compile on Windows all dust templates and generate the .js files. The problem is that I still have the 500 error when running node on production mode...

@lmarkus
Copy link
Contributor Author

lmarkus commented Jan 27, 2014

Can you point me to the repo where you've been doing the work?

@alexsantos
Copy link
Contributor

I've been doing this locally on my pc but I've forked makara just now so I
can show you what I've been doing. Just a minute :-)

2014-01-27 Lenny Markus notifications@github.com

Can you point me to the repo where you've been doing the work?


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-33433277
.

@alexsantos
Copy link
Contributor

https://github.com/AlexSantos/makara/blob/fix-windows-build/tasks/dustjs-i18n.js

2014-01-27 Alexandre Santos santosam72@gmail.com

I've been doing this locally on my pc but I've forked makara just now so I
can show you what I've been doing. Just a minute :-)

2014-01-27 Lenny Markus notifications@github.com

Can you point me to the repo where you've been doing the work?


Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-33433277
.

@alexsantos
Copy link
Contributor

@lmarkus , I hope it helped to solve the problem.

@lmarkus
Copy link
Contributor Author

lmarkus commented Jan 30, 2014

Fixed via d77202e

@lmarkus lmarkus closed this as completed Jan 30, 2014
@lmarkus
Copy link
Contributor Author

lmarkus commented Jan 30, 2014

@alexsantos Part of the solution 😄

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

2 participants