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

Windows build requires views.yaml query paths to have "queries\\*.rq" #100

Closed
redmer opened this issue Apr 4, 2024 · 0 comments · Fixed by #101
Closed

Windows build requires views.yaml query paths to have "queries\\*.rq" #100

redmer opened this issue Apr 4, 2024 · 0 comments · Fixed by #101
Labels
🐛 bug Something isn't working

Comments

@redmer
Copy link
Contributor

redmer commented Apr 4, 2024

Love this project! Using the example from the README, I've made a views.yaml file containing:

views:
  - output: "index.html"
    query: "works.rq"
    template: "index.html"

This works as expected on Linux (Ubuntu 20.04 [self compiled, following instructions]), but using the precompiled Windows binary:

PS \ ..\bin\snowman.exe build
Building project with 1 views.
Error: SPARQL query failed. Error: The given query could not be found. works.rq

The Windows binary works when the views.yaml file is as follows, but then it wouldn't work on the Linux runner.

views:
  - output: "index.html"
    query: "queries\\works.rq"
    template: "index.html"

I haven't written Go before, but perhaps filepath.Walk in

snowman/cmd/build.go

Lines 46 to 56 in 7e07091

err := filepath.Walk("queries", func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() {
sparqlBytes, err := ioutil.ReadFile(path)
if err != nil {
return err
}
index[strings.Replace(path, "queries/", "", 1)] = string(sparqlBytes)
uses, like filepath.WalkDir operating-system specific path separators.
The strings.Replace call then might be able to use something like "queries" + os.PathSeparator?

I've written a small change PR which will add the above to cmd/build.go which appears to do what I want. I'll submit that momentarily.

I can't oversee how interoperability of these filepaths might work with longer subdirs for queries and templates.
Not for the other places in the code where regular slashes are used.
Any slashes (regular /) do work as expected in the view output and create subdirs in the output site.

@Abbe98 Abbe98 added the 🐛 bug Something isn't working label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants