mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
check if groups file exists
This commit is contained in:
parent
34e6e61dc2
commit
174ed2dd2e
1 changed files with 28 additions and 17 deletions
|
@ -170,6 +170,10 @@ func InitConfig() error {
|
||||||
|
|
||||||
func ReadGroupsFile(path string) error {
|
func ReadGroupsFile(path string) error {
|
||||||
|
|
||||||
|
_, err := os.Stat(path)
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
|
||||||
jsonFile, err := os.Open(path)
|
jsonFile, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error opening json file for groups: %v", err)
|
return fmt.Errorf("error opening json file for groups: %v", err)
|
||||||
|
@ -187,5 +191,12 @@ func ReadGroupsFile(path string) error {
|
||||||
|
|
||||||
log.Println("ScenarioGroupMap", ScenarioGroupMap)
|
log.Println("ScenarioGroupMap", ScenarioGroupMap)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
} else if os.IsNotExist(err) {
|
||||||
|
log.Println("File does not exist, no goups/scenarios mapping created:", path)
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
log.Println("Something is wrong with this file path:", path)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue