Improve Kawa library path finding#1079
Conversation
lib/chibi/snow/commands.scm
Outdated
| (display "(import (scheme base) (scheme write) (scheme process-context))") | ||
| (newline) | ||
| (display "(display (get-environment-variable \"CLASSPATH\"))"))) | ||
| (process->string `(kawa ,tmp-path)))) |
There was a problem hiding this comment.
Just
(process->string `(kawa -e "(display (get-environment-variable \"CLASSPATH\"))"))
should work. Also try to fall back to something reasonable if this command fails.
There was a problem hiding this comment.
Kawa (the binary startup script) sets first item of CLASSPATH to be /usr/local/share/kawa/lib/kawa.jar. And adds any additional classpaths after that. So by default the value is /usr/local/share/kawa/lib/kawa.jar:. With CLASSPATH=/userclasspath kawa it is then /usr/local/share/kawa/lib/kawa.jar:/userclasspath.
I think splitting the CLASSPATH by .. Then checking that first item ends with kawa. If not return default, if it does remove kawa from end and return that. Should work. On windows the separator is ;, so this gets around that too.
lib/chibi/snow/commands.scm
Outdated
| (string-split | ||
| (process->string | ||
| `(kawa -e "(display (get-environment-variable \"CLASSPATH\"))")) | ||
| #\.))) |
There was a problem hiding this comment.
Splitting on dot won't work, e.g. I have /kawa-3.1.1/ in my path. How about splitting on : and dropping the kawa.jar?
There was a problem hiding this comment.
Good catch, thank you! I'll make it split on : and drop kawa.jar.
Kawa binary sets first item of CLASSPATH to be, on default install, /usr/local/share/lib/kawa/kawa.jar. So the library install path can be taken from there. It now works even when Kawa is not installed with default configuration.
Additionally --install-prefix option is also added before the install path.