diff options
author | Tommy Nguyen <remyabel@gmail.com> | 2018-08-19 07:22:48 -0400 |
---|---|---|
committer | Tommy Nguyen <remyabel@gmail.com> | 2018-08-19 07:22:48 -0400 |
commit | d2bdac29aa7038177ab26f91c06d9f01703d97c5 (patch) | |
tree | 3b9635fb705020360ff62ee349c36bf1b5bfc271 /pkg/utils | |
parent | cea736e6e92bb0c37b61af15da9c261b79eb3c9b (diff) | |
parent | e6712832b502bf893d11d0c891f5ab1b69242fec (diff) |
Merge branch 'master' into 157_remove_bom
Diffstat (limited to 'pkg/utils')
-rw-r--r-- | pkg/utils/utils.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index d53ddc6dd..37e76d78a 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -69,3 +69,14 @@ func NormalizeLinefeeds(str string) string { str = strings.Replace(str, "\r", "\n", -1) return str } + +// GetProjectRoot returns the path to the root of the project. Only to be used +// in testing contexts, as with binaries it's unlikely this path will exist on +// the machine +func GetProjectRoot() string { + dir, err := os.Getwd() + if err != nil { + panic(err) + } + return strings.Split(dir, "lazygit")[0] + "lazygit" +} |