fixed env and log file path
This commit is contained in:
parent
303051fd46
commit
e3cc322594
9
main.go
9
main.go
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -9,8 +10,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
envFile = flag.String("env", "$HOME/.config/i3-wrapper/environment", "environment file with variable definitions")
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
logFile, err := os.Create("/home/tordarus/.i3.log")
|
logFile, err := os.Create(filepath.Join(os.Getenv("HOME"), ".i3.log"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
}
|
}
|
||||||
@ -26,7 +31,7 @@ func main() {
|
|||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = os.Environ()
|
||||||
if envData, err := ioutil.ReadFile(filepath.Join(os.Getenv("HOME"), ".config/i3wrapper/environment")); err == nil {
|
if envData, err := ioutil.ReadFile(os.ExpandEnv(*envFile)); err == nil {
|
||||||
cmd.Env = append(cmd.Env, strings.Split(string(envData), "\n")...)
|
cmd.Env = append(cmd.Env, strings.Split(string(envData), "\n")...)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user