Commit Graph

2 Commits

Author SHA1 Message Date
Sundaram Ramaswamy
3b17f15a7d highlight: Make program relocatable 2023-07-12 09:38:11 +05:30
Sundaram Ramaswamy
a1955e09cb Fix DATADIR path
Running `highlight -O truecolor test.cpp` throws

> cannot open filetypes.conf: No such file or directory
> highlight: cannot open themes\edit-vim-dark.theme: No such file or directory

since highlight.exe expects `themes/`, `langsDefs/` and `plugins/`
directories to be under the same directory as `highlight.exe` on
Windows.

* Add `HL_DATA_DIR` and `HL_CONFIG_DIR` to possible search directories
  even if `_WIN32` is defined.
* Workaround [MinGW bug #810][1] where `stat()` reports directory as
  missing when there’s a trailing slash in path
  - This is needed for `--list-scripts` option to work
* Remove binary path from possible search directories since in MSYS2
  systems the `/bin` directories never have assets.

[1]: https://sourceforge.net/p/mingw-w64/bugs/810/
2022-10-11 09:21:33 +05:30