mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-29 23:17:32 +02:00
use platform agnostic filepaths
This commit is contained in:
parent
1f5f80b1bf
commit
750445dc8b
14
main.go
14
main.go
@ -38,16 +38,21 @@ func homeDirectory() string {
|
|||||||
return usr.HomeDir
|
return usr.HomeDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func projectPath(path string) string {
|
||||||
|
gopath := os.Getenv("GOPATH")
|
||||||
|
return filepath.FromSlash(gopath + "/src/github.com/jesseduffield/lazygit/" + path)
|
||||||
|
}
|
||||||
|
|
||||||
func devLog(objects ...interface{}) {
|
func devLog(objects ...interface{}) {
|
||||||
localLog(color.FgWhite, homeDirectory()+"/go/src/github.com/jesseduffield/lazygit/development.log", objects...)
|
localLog(color.FgWhite, projectPath("development.log"), objects...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func colorLog(colour color.Attribute, objects ...interface{}) {
|
func colorLog(colour color.Attribute, objects ...interface{}) {
|
||||||
localLog(colour, homeDirectory()+"/go/src/github.com/jesseduffield/lazygit/development.log", objects...)
|
localLog(colour, projectPath("development.log"), objects...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func commandLog(objects ...interface{}) {
|
func commandLog(objects ...interface{}) {
|
||||||
localLog(color.FgWhite, homeDirectory()+"/go/src/github.com/jesseduffield/lazygit/commands.log", objects...)
|
localLog(color.FgWhite, projectPath("commands.log"), objects...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func localLog(colour color.Attribute, path string, objects ...interface{}) {
|
func localLog(colour color.Attribute, path string, objects ...interface{}) {
|
||||||
@ -75,8 +80,7 @@ func navigateToRepoRootDirectory() {
|
|||||||
// with `date` and `commit`. If this program has been opened directly via go,
|
// with `date` and `commit`. If this program has been opened directly via go,
|
||||||
// we will populate the `version` with VERSION in the lazygit root directory
|
// we will populate the `version` with VERSION in the lazygit root directory
|
||||||
func fallbackVersion() string {
|
func fallbackVersion() string {
|
||||||
gopath := os.Getenv("GOPATH")
|
path := projectPath("VERSION")
|
||||||
path := filepath.FromSlash(gopath + "/src/github.com/jesseduffield/lazygit/VERSION")
|
|
||||||
byteVersion, err := ioutil.ReadFile(path)
|
byteVersion, err := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "unversioned"
|
return "unversioned"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user