Compare commits

..

No commits in common. "e34ab5314a2aa659a66b72d4f8fb1e07fc7ba140" and "9d69b63a0f7cd7f10b9e1d7a9154966940647938" have entirely different histories.

6 changed files with 8 additions and 9 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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'"

View File

@ -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")
)

View File

@ -17,5 +17,4 @@ var (
dataDir = "/usr/share/hilbish"
preloadPath = dataDir + "/prelude/init.lua"
sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
defaultConfDir = ""
)

View File

@ -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 = ""
)