glug icon indicating copy to clipboard operation
glug copied to clipboard

Glug binary doesn't work with include_file

Open gravitystorm opened this issue 2 years ago • 0 comments

If I try to use the glug command with a complex stylesheet that has multiple files, it fails to resolve the paths given by "include_file" statements. An example error message for a style.glug with include_file "landcover.glug" is:

 No such file or directory @ rb_sysopen - /landcover.glug (Errno::ENOENT)

I think this is because the glug command doesn't pass a base_dir option to Stylesheet.new, and File.join('', 'foo') == "/foo"

Since base_dir is only used when handling "include_file", perhaps it's possible to remove this option entirely, and treat all "include_file" as relative paths to the file that has the statement? This would also mean for example that you could do:

  • style.glug - include_file "shared/landcover.glug"
  • shared/landcover.glug - include_file "colours.glug" <- this would load shared/colours.glug

But if that's not possible, then the glug binary should at least pass the directory of the target file as the base_dir.

gravitystorm avatar Jan 06 '23 18:01 gravitystorm