mirror of https://github.com/Hilbis/Hilbish
fix: create directory for hist dir if it doesnt exist
parent
9165e0bdf9
commit
605574f262
9
main.go
9
main.go
|
@ -55,12 +55,12 @@ func main() {
|
||||||
defaultConfPath = filepath.Join(confDir, "hilbish", "init.lua")
|
defaultConfPath = filepath.Join(confDir, "hilbish", "init.lua")
|
||||||
} else {
|
} else {
|
||||||
// else do ~ substitution
|
// else do ~ substitution
|
||||||
defaultConfPath = filepath.Join(strings.Replace(defaultConfDir, "~", homedir, 1), "init.lua")
|
defaultConfPath = filepath.Join(expandHome(defaultHistDir), "init.lua")
|
||||||
}
|
}
|
||||||
if defaultHistDir == "" {
|
if defaultHistDir == "" {
|
||||||
defaultHistPath = filepath.Join(userDataDir, "hilbish", ".hilbish-history")
|
defaultHistPath = filepath.Join(userDataDir, "hilbish", ".hilbish-history")
|
||||||
} else {
|
} else {
|
||||||
defaultHistPath = filepath.Join(strings.Replace(defaultHistDir, "~", homedir, 1), ".hilbish-history")
|
defaultHistPath = filepath.Join(expandHome(defaultHistDir), ".hilbish-history")
|
||||||
}
|
}
|
||||||
helpflag := getopt.BoolLong("help", 'h', "Prints Hilbish flags")
|
helpflag := getopt.BoolLong("help", 'h', "Prints Hilbish flags")
|
||||||
verflag := getopt.BoolLong("version", 'v', "Prints Hilbish version")
|
verflag := getopt.BoolLong("version", 'v', "Prints Hilbish version")
|
||||||
|
@ -263,3 +263,8 @@ func handleHistory(cmd string) {
|
||||||
// TODO: load history again (history shared between sessions like this ye)
|
// TODO: load history again (history shared between sessions like this ye)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func expandHome(path string) string {
|
||||||
|
homedir := curuser.HomeDir
|
||||||
|
|
||||||
|
return strings.Replace(defaultHistDir, "~", homedir, 1)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue