fix: make macOS config path match Linux (#143)

Also moves some variables around in vars_*.go to accommodate the fix.
pull/145/head
Will Eccles 2022-04-19 22:12:05 -04:00 committed by GitHub
parent 0ae31123b9
commit e34ab5314a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 3 deletions

View File

@ -44,7 +44,7 @@ func main() {
// i honestly dont know what directories to use for this
switch runtime.GOOS {
case "linux":
case "linux", "darwin":
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 = expandHome(defaultConfDir)
defaultConfDir = filepath.Join(expandHome(defaultConfDir), "hilbish")
}
defaultConfPath = filepath.Join(defaultConfDir, "init.lua")
if defaultHistDir == "" {

View File

@ -3,7 +3,6 @@ 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,4 +17,5 @@ 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,4 +17,5 @@ var (
dataDir = "/usr/share/hilbish"
preloadPath = dataDir + "/prelude/init.lua"
sampleConfPath = dataDir + "/.hilbishrc.lua" // Path to default/sample config
defaultConfDir = ""
)

View File

@ -11,4 +11,5 @@ var (
dataDir = "~\\Appdata\\Roaming\\Hilbish" // ~ and \ gonna cry?
preloadPath = dataDir + "\\prelude\\init.lua"
sampleConfPath = dataDir + "\\hilbishrc.lua" // Path to default/sample config
defaultConfDir = ""
)