aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2020-02-12 21:04:55 +0100
committerJulien Dessaux2020-02-12 21:04:55 +0100
commit211adff0b060023fe0c91e1950d80d3a36d61868 (patch)
tree2fea7d5d39a6dff4f0276018b9bf23f2debc412c
parentAdded tests for job package (diff)
downloadbareos-zabbix-check-211adff0b060023fe0c91e1950d80d3a36d61868.tar.gz
bareos-zabbix-check-211adff0b060023fe0c91e1950d80d3a36d61868.tar.bz2
bareos-zabbix-check-211adff0b060023fe0c91e1950d80d3a36d61868.zip
Fixed code that used the wrong path manipulation module
-rw-r--r--config/statefile.go8
-rw-r--r--config/workdir.go4
-rw-r--r--spool/load.go4
-rw-r--r--spool/save.go4
4 files changed, 10 insertions, 10 deletions
diff --git a/config/statefile.go b/config/statefile.go
index 8b9f0a9..22fd214 100644
--- a/config/statefile.go
+++ b/config/statefile.go
@@ -4,7 +4,7 @@ import (
"fmt"
"log"
"os"
- "path"
+ "path/filepath"
)
const (
@@ -15,17 +15,17 @@ const (
func (c *Config) checkStateFile() {
// Finds the state file to parse
if c.stateFile != "" {
- c.stateFile = path.Join(c.workDir, c.stateFile)
+ c.stateFile = filepath.Join(c.workDir, c.stateFile)
info, err := os.Stat(c.stateFile)
if os.IsNotExist(err) || info.IsDir() {
fmt.Printf("INFO The state file %s does not exist.\n", c.stateFile)
os.Exit(0)
}
} else {
- c.stateFile = path.Join(c.workDir, bareosStateFile)
+ c.stateFile = filepath.Join(c.workDir, bareosStateFile)
info, err := os.Stat(c.stateFile)
if os.IsNotExist(err) || info.IsDir() {
- c.stateFile = path.Join(c.workDir, baculaStateFile)
+ c.stateFile = filepath.Join(c.workDir, baculaStateFile)
info, err = os.Stat(c.stateFile)
if os.IsNotExist(err) || info.IsDir() {
fmt.Println("INFO Could not find a suitable state file. Has a job ever run?")
diff --git a/config/workdir.go b/config/workdir.go
index 283fdc5..208df1a 100644
--- a/config/workdir.go
+++ b/config/workdir.go
@@ -4,7 +4,7 @@ import (
"fmt"
"log"
"os"
- "path"
+ "path/filepath"
)
const (
@@ -33,7 +33,7 @@ func (c *Config) checkWorkDir() {
}
}
}
- c.workDir = path.Clean(c.workDir)
+ c.workDir = filepath.Clean(c.workDir)
if c.verbose {
log.Println("Setting work directory to ", c.workDir)
}
diff --git a/spool/load.go b/spool/load.go
index 282fdc6..5b08bda 100644
--- a/spool/load.go
+++ b/spool/load.go
@@ -7,7 +7,7 @@ import (
"fmt"
"log"
"os"
- "path"
+ "path/filepath"
"strconv"
)
@@ -15,7 +15,7 @@ import (
func (s *Spool) Load(c *config.Config) (err error) {
s.config = c
// We read the spool
- file, err := os.Open(path.Join(c.WorkDir(), spoolFile))
+ file, err := os.Open(filepath.Join(c.WorkDir(), spoolFile))
if err != nil {
return fmt.Errorf("Couldn't open spool file, starting from scratch: %s", err)
}
diff --git a/spool/save.go b/spool/save.go
index b01dc7b..f25b86a 100644
--- a/spool/save.go
+++ b/spool/save.go
@@ -4,12 +4,12 @@ import (
"encoding/csv"
"fmt"
"os"
- "path"
+ "path/filepath"
)
// Save writes a spool on the disk
func (s *Spool) Save() (err error) {
- file, err := os.Create(path.Join(s.config.WorkDir(), spoolFile))
+ file, err := os.Create(filepath.Join(s.config.WorkDir(), spoolFile))
if err != nil {
return
}