0
Crystal項目中Crystal shards的默認安裝目錄是「lib /」。是否可以自定義路徑?是否可以指定一個自定義的「lib /」分片安裝目錄?
Crystal項目中Crystal shards的默認安裝目錄是「lib /」。是否可以自定義路徑?是否可以指定一個自定義的「lib /」分片安裝目錄?
看來你可以設置一個環境變量SHARDS_INSTALL_PATH
。但是這並沒有記錄,應該小心處理。
爲什麼你需要不同的安裝目錄呢?
# This sets the install path when you do `crystal deps`.
# It needs to be an absoluete path, not a relative path.
export SHARDS_INSTALL_PATH="$PWD/my/dir"
# This is needed for the Crystal compiler to the find the shards.
# The Crystal compiler does not use SHARDS_INSTAL_PATH.
# Unlike SHARDS_INSTALL_PATH, it can be a relative path.
# You must also specify the place for the Crystal source directory
# in order to find the Standard Lib .cr files:
export CRYSTAL_PATH="$SHARDS_INSTALL_PATH:the/crystal/src"
# Now you can do:
crystal deps # uses SHARDS_INSTALL_PATH
crystal build src/my-file.cr # uses CRYSTAL_PATH
來源:試錯誤和grep-ING的源代碼既shardsCrystal和。
注意:由於前面陳述的Johannes Müller,這是無證的。
我只是不喜歡'lib'或'libs'作爲安裝目錄。我傾向於在相同的回購協議中使用不同的編程語言,並且使用'lib'會增加衝突的可能性。 (我意識到這不是一個好理由,但我仍然不得不問,以防萬一它出現。) –