read system-wide configuration at '/etc/lfrc'
This commit is contained in:
1 parent
6c319316e2
commit
638d67c0e4
3 files changed
+13
-8
No files matched your search
@@ -32,8 +32,10 @@ func run() {
|
|||||||
|
|
||||||
app := newApp()
|
app := newApp()
|
||||||
|
|
||||||
if _, err := os.Stat(gConfigPath); !os.IsNotExist(err) {
|
for _, path := range gConfigPaths {
|
||||||
app.readFile(gConfigPath)
|
if _, err := os.Stat(path); !os.IsNotExist(err) {
|
||||||
|
app.readFile(path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.loop()
|
app.loop()
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
gUser *user.User
|
gUser *user.User
|
||||||
gConfigPath string
|
gConfigPaths []string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -41,7 +41,10 @@ func init() {
|
|||||||
config = filepath.Join(gUser.HomeDir, ".config")
|
config = filepath.Join(gUser.HomeDir, ".config")
|
||||||
}
|
}
|
||||||
|
|
||||||
gConfigPath = filepath.Join(config, "lf", "lfrc")
|
gConfigPaths = []string{
|
||||||
|
filepath.Join("/etc", "lfrc"),
|
||||||
|
filepath.Join(config, "lf", "lfrc"),
|
||||||
|
}
|
||||||
|
|
||||||
gDefaultSocketPath = filepath.Join(os.TempDir(), fmt.Sprintf("lf.%s.sock", gUser.Username))
|
gDefaultSocketPath = filepath.Join(os.TempDir(), fmt.Sprintf("lf.%s.sock", gUser.Username))
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -16,8 +16,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
gUser *user.User
|
gUser *user.User
|
||||||
gConfigPath string
|
gConfigPaths []string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -30,7 +30,7 @@ func init() {
|
|||||||
// remove domain prefix
|
// remove domain prefix
|
||||||
gUser.Username = strings.Split(gUser.Username, `\`)[1]
|
gUser.Username = strings.Split(gUser.Username, `\`)[1]
|
||||||
|
|
||||||
gConfigPath = filepath.Join(gUser.HomeDir, "AppData", "Local", "lf", "lfrc")
|
gConfigPaths = []string{filepath.Join(gUser.HomeDir, "AppData", "Local", "lf", "lfrc")}
|
||||||
}
|
}
|
||||||
|
|
||||||
func pauseCommand() *exec.Cmd {
|
func pauseCommand() *exec.Cmd {
|
||||||
|
|||||||
Reference in new issue
Block a user