glaciers-in-archives / snowman

A static site generator for SPARQL backends.
GNU Lesser General Public License v3.0
114 stars 11 forks source link

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

Closed redmer closed 7 months ago

redmer commented 7 months ago

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 https://github.com/glaciers-in-archives/snowman/blob/7e070914e2ee8cde3d8c70f861220b2763045016/cmd/build.go#L46-L56 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.