-
Notifications
You must be signed in to change notification settings - Fork 369
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
Make the builder happier with Windows environments #1356
Conversation
There's two main issues with Windows environments: * Slashes * Windows still notifies about some directories we've ignored, therefore we need to filter them too It's not super pretty, but it does work.
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 guess I'm a bit late to the review party, but...
@@ -99,6 +99,7 @@ func makeWalker(base string, w *fsnotify.Watcher) filepath.WalkFunc { | |||
} | |||
|
|||
// skip a few things that we know don't form part of the spec | |||
rel = strings.Replace(rel, "\\", "/", -1) // normalize slashes (thanks to windows) |
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.
should this be rel = filepath.ToSlash
instead? (https://golang.org/pkg/path/filepath/#ToSlash )
@@ -125,6 +126,14 @@ func filter(e fsnotify.Event) bool { | |||
return false | |||
} | |||
|
|||
// Forcefully ignore directories we don't care about (Windows, at least, tries to notify about some directories) | |||
filePath := strings.Replace(e.Name, "\\", "/", -1) // normalize slashes (thanks to windows) |
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.
same as above
@@ -149,6 +158,10 @@ func serve(w http.ResponseWriter, req *http.Request) { | |||
} | |||
b, ok = m.bytes[file] | |||
|
|||
if !ok { | |||
b, ok = m.bytes[strings.Replace(file, "/", "\\", -1)] // Attempt a Windows lookup |
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.
should this be ...filepath.FromSlash(file)
... instead (probably in the original b, ok = m.bytes...
line)?
There's two main issues with Windows environments:
It's not super pretty, but it does work.