Add the keymap configuration file
This commit is contained in:
parent
589bb9d144
commit
e6bff5a4a4
2 changed files with 39 additions and 30 deletions
14
agent.go
14
agent.go
|
@ -3,6 +3,8 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
)
|
||||
|
@ -29,10 +31,16 @@ func watchForConfigChanges() {
|
|||
}
|
||||
}()
|
||||
|
||||
// TODO: Add working directory
|
||||
err = watcher.Add("/tmp/test")
|
||||
// The configuration file need to be in the same directory as the binary.
|
||||
// Later on, we can add other paths, where the file can be placed (like as a
|
||||
// dotfile in the home directory or in the .config/n3rdpad/ folder or other
|
||||
// places where windows will put it).
|
||||
config_path, err := os.Getwd()
|
||||
config_file := path.Join(config_path, "keymap.conf")
|
||||
|
||||
err = watcher.Add(config_file)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
log.Fatal("Can't find the 'keymap.conf' configuration file. Please create one.")
|
||||
}
|
||||
<-done
|
||||
}
|
||||
|
|
1
keymap.conf
Normal file
1
keymap.conf
Normal file
|
@ -0,0 +1 @@
|
|||
test
|
Reference in a new issue