mirror of
https://github.com/matrix-org/matrix-spec
synced 2025-12-25 18:38:37 +01:00
Merge pull request #1356 from turt2live/travis/windows-2.0
Make the builder happier with Windows environments
This commit is contained in:
commit
26a62bc07f
|
|
@ -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)
|
||||
if rel == "api/node_modules" ||
|
||||
rel == "scripts/gen" ||
|
||||
rel == "scripts/tmp" {
|
||||
|
|
@ -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)
|
||||
if strings.Contains(filePath, "/scripts/tmp") ||
|
||||
strings.Contains(filePath, "/scripts/gen") ||
|
||||
strings.Contains(filePath, "/api/node_modules") {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -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
|
||||
}
|
||||
|
||||
if ok && file == "api-docs.json" {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue