mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "e34ab5314a2aa659a66b72d4f8fb1e07fc7ba140" and "9d69b63a0f7cd7f10b9e1d7a9154966940647938" have entirely different histories.
e34ab5314a
...
9d69b63a0f
7
main.go
7
main.go
|
@ -44,7 +44,7 @@ func main() {
|
|||
|
||||
// i honestly dont know what directories to use for this
|
||||
switch runtime.GOOS {
|
||||
case "linux", "darwin":
|
||||
case "linux":
|
||||
userDataDir = getenv("XDG_DATA_HOME", curuser.HomeDir + "/.local/share")
|
||||
default:
|
||||
// this is fine on windows, dont know about others
|
||||
|
@ -56,7 +56,7 @@ func main() {
|
|||
defaultConfDir = filepath.Join(confDir, "hilbish")
|
||||
} else {
|
||||
// else do ~ substitution
|
||||
defaultConfDir = filepath.Join(expandHome(defaultConfDir), "hilbish")
|
||||
defaultConfDir = expandHome(defaultHistDir)
|
||||
}
|
||||
defaultConfPath = filepath.Join(defaultConfDir, "init.lua")
|
||||
if defaultHistDir == "" {
|
||||
|
@ -275,7 +275,8 @@ func handleHistory(cmd string) {
|
|||
|
||||
func expandHome(path string) string {
|
||||
homedir := curuser.HomeDir
|
||||
return strings.Replace(path, "~", homedir, 1)
|
||||
|
||||
return strings.Replace(defaultHistDir, "~", homedir, 1)
|
||||
}
|
||||
|
||||
func removeDupes(slice []string) []string {
|
||||
|
|
|
@ -93,9 +93,9 @@ func DoFile(rtm *rt.Runtime, path string) error {
|
|||
buf = append(buf, line...)
|
||||
}
|
||||
|
||||
clos, err := rtm.LoadFromSourceOrCode(path, buf, "bt", rt.TableValue(rtm.GlobalEnv()), false)
|
||||
if clos != nil {
|
||||
_, err = rt.Call1(rtm.MainThread(), rt.FunctionValue(clos))
|
||||
chunk, err := rtm.CompileAndLoadLuaChunk(path, buf, rt.TableValue(rtm.GlobalEnv()))
|
||||
if chunk != nil {
|
||||
_, err = rt.Call1(rtm.MainThread(), rt.FunctionValue(chunk))
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
1
vars.go
1
vars.go
|
@ -3,6 +3,7 @@ package main
|
|||
// String vars that are free to be changed at compile time
|
||||
var (
|
||||
version = "v2.0.0"
|
||||
defaultConfDir = "" // ~ will be substituted for home, path for user's default config
|
||||
defaultHistDir = ""
|
||||
commonRequirePaths = "';./libs/?/init.lua;./?/init.lua;./?/?.lua'"
|
||||
|
||||
|
|
|
@ -17,5 +17,4 @@ var (
|
|||
dataDir = "/usr/local/share/hilbish"
|
||||
preloadPath = dataDir + "/prelude/init.lua"
|
||||
sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
|
||||
defaultConfDir = getenv("XDG_CONFIG_HOME", "~/.config")
|
||||
)
|
||||
|
|
|
@ -17,5 +17,4 @@ var (
|
|||
dataDir = "/usr/share/hilbish"
|
||||
preloadPath = dataDir + "/prelude/init.lua"
|
||||
sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
|
||||
defaultConfDir = ""
|
||||
)
|
||||
|
|
|
@ -11,5 +11,4 @@ var (
|
|||
dataDir = "~\\Appdata\\Roaming\\Hilbish" // ~ and \ gonna cry?
|
||||
preloadPath = dataDir + "\\prelude\\init.lua"
|
||||
sampleConfPath = dataDir + "\\hilbishrc.lua" // Path to default/sample config
|
||||
defaultConfDir = ""
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue