now prints the absolute path
This commit is contained in:
parent
1b14fcbea4
commit
9592e4bb63
14
main.go
14
main.go
@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -135,6 +136,15 @@ func getNextWait(config sunsetConfig) (int, int) {
|
||||
return diffHr, diffMin
|
||||
}
|
||||
|
||||
func currentImage(configPath string, config sunsetConfig) string {
|
||||
index := currentIndex(config)
|
||||
absFile, err := filepath.Abs(path.Join(path.Dir(configPath), config.Files[index].File))
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
return absFile
|
||||
}
|
||||
|
||||
func block(config sunsetConfig, command string) {
|
||||
for {
|
||||
nextHr, nextMin := getNextWait(config)
|
||||
@ -176,9 +186,7 @@ func main() {
|
||||
}
|
||||
block(conf, *blockCommand)
|
||||
} else {
|
||||
index := currentIndex(conf)
|
||||
absoluteImagePath := path.Join(path.Dir(*configFile), conf.Files[index].File)
|
||||
fmt.Printf("%s", absoluteImagePath)
|
||||
fmt.Printf("%s", currentImage(*configFile, conf))
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user