Search code examples
crystal-lang

Crystal lang : How to indicate require path for crystal compiler


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.


Solution

  • 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