If some of my libraries locate out of default directory lib
, could I indicate the require path to compile successfully without lib
directory nor shards.yml
.
Yes, change the CRYSTAL_PATH
environment variable. By default it's $CRYSTAL_ROOT/src:lib
(the src
directory of the installation, and then the relative lib
directory). Just add :some_other_dir
at the end of that.
Example: CRYSTAL_PATH=$CRYSTAL_ROOT/src:lib:~/my_lib_dir
It didn't work as mentioned in another answer, this won't work CRYSTAL_PATH=$CRYSTAL_ROOT/src:lib:~/my_lib_dir
.
Because in my case the CRYSTAL_ROOT
was blank.
The solution was to execute crystal env
and copy from there whatever paths it has for CRYSTAL_PATH
and then re-set it as CRYSTAL_PATH=whatever-paths-you-just-copied:~/my_lib_dir
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With