如何获取Elixir项目的根目录 [英] How To Get The Root Directory Of an Elixir Project
本文介绍了如何获取Elixir项目的根目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Elixir项目中,您可以使用
In an Elixir project, you can use
Path.expand
定义文件或目录作为当前文件的相对路径。
to define a file or directory as a relative path from the current file.
例如: Path.expand( ../../../ lib / file.ex)
但是如何从项目的根目录查找路径?
but how about finding a path from the root level of the project?
推荐答案
如果要获取项目的根目录,使用
If you'd like to get the project's root directory, use
File.cwd!
来源: https://groups.google.com/d/topic/elixir-lang-talk/Ls0eJDdMMW8
(注意:我只是在这里拉了它,这样它才不会被埋在Google身份验证墙后面的死论坛中,并且不受Google数据保存政策的约束)
这篇关于如何获取Elixir项目的根目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文