fix: only create rc file if it doesn't exist (#10)

pull/11/head
devins2518 2021-03-25 11:07:51 -05:00 committed by GitHub
parent eeafd1e5cf
commit e4218a135a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

14
main.go
View File

@ -59,12 +59,14 @@ func main() {
} }
homedir, _ := os.UserHomeDir() homedir, _ := os.UserHomeDir()
err = os.WriteFile(homedir + "/.hilbishrc.lua", input, 0644) if _, err := os.Stat(homedir + "/.hilbishrc.lua"); os.IsNotExist(err) {
if err != nil { err = os.WriteFile(homedir + "/.hilbishrc.lua", input, 0644)
fmt.Println("Error creating config file") if err != nil {
fmt.Println(err) fmt.Println("Error creating config file")
return fmt.Println(err)
} return
}
}
HandleSignals() HandleSignals()
LuaInit() LuaInit()