1 Star 0 Fork 0

fullstack/mage

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
runtime.go 952 Bytes
一键复制 编辑 原始数据 按行查看 历史
Nate Finch 提交于 2017-10-03 10:22 +08:00 . Helpers galore (#26)
package mg
import (
"os"
"path/filepath"
"runtime"
)
// CacheEnv is the environment variable that users may set to change the
// location where mage stores its compiled binaries.
const CacheEnv = "MAGEFILE_CACHE"
// verboseEnv is the environment variable that indicates the user requested
// verbose mode when running a magefile.
const verboseEnv = "MAGEFILE_VERBOSE"
// Verbose reports whether a magefile was run with the verbose flag.
func Verbose() bool {
return os.Getenv(verboseEnv) != ""
}
// CacheDir returns the directory where mage caches compiled binaries. It
// defaults to $HOME/.magefile, but may be overridden by the MAGEFILE_CACHE
// environment variable.
func CacheDir() string {
d := os.Getenv(CacheEnv)
if d != "" {
return d
}
switch runtime.GOOS {
case "windows":
return filepath.Join(os.Getenv("HOMEDRIVE"), os.Getenv("HOMEPATH"), "magefile")
default:
return filepath.Join(os.Getenv("HOME"), ".magefile")
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fullstack_admin/mage.git
git@gitee.com:fullstack_admin/mage.git
fullstack_admin
mage
mage
v1.0.2

搜索帮助