sanette / bogue

GUI library for ocaml based on SDL2
http://sanette.github.io/bogue/Principles.html
Other
181 stars 15 forks source link

Use Windows directories on Windows #12

Closed jonahbeckford closed 1 year ago

jonahbeckford commented 1 year ago

Native Windows does not have the HOME environment variables, so the theme code throws a Not_found exception.

sanette commented 1 year ago

Maybe one could check if Sys.unix then ...

zapashcanon commented 1 year ago

You could also use directories.

sanette commented 1 year ago

You could also use directories.

Right, I know, this is what the comments in the code say ;)

jonahbeckford commented 1 year ago

Updated the PR and made Windows match what directories would give.

(Yes, directories seems way cleaner and more robust since environment variables are not always present. For now, this PR just unblocks the critical bug that made bogue unusable on native Windows. Think you can have a separate PR for fixing tech debt. While we are talking about tech debt, B_theme.download_conf () can only work on Unix; something like ocaml-crunch can avoid the need for downloading with wget and performing tar)

sanette commented 1 year ago

something like ocaml-crunch can avoid the need for downloading with wget and performing tar

I think this is a good idea. There is also ppx_blob. Do you have an opinion about which one to choose?

sanette commented 1 year ago

For reference, I'd like to merge this PR and then use the (conflicting) directory PR by @zapashcanon

jonahbeckford commented 1 year ago

something like ocaml-crunch can avoid the need for downloading with wget and performing tar

I think this is a good idea. There is also ppx_blob. Do you have an opinion about which one to choose?

I have used ocaml-crunch extensively (and contributed a bit to it so it works cleanly on Windows). ppx_blob I have used with Dune 2.9, but it has an open bug with working with Dune 3.x. Because of the open bug I would stick to ocaml-crunch.

In general, I would use ocaml-crunch if you have an entire directory you want to package up (like a theme directory). ppx_blob is best for simpler use cases (ex. only one file).

zapashcanon commented 1 year ago

Yes, I would recommend using ocaml-crunch too.