rebuilt command flag system
This commit is contained in:
38
config.go
38
config.go
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
@@ -42,40 +41,3 @@ func readCfg(factCfg string) UsrConfig {
|
||||
}
|
||||
return config
|
||||
}
|
||||
func isItReal(path string) bool { //check if path exists
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
return true
|
||||
} else if errors.Is(err, os.ErrNotExist) {
|
||||
return false
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
func verifyConfig(config UsrConfig) bool { // check each file/dir to see if it exists
|
||||
if !isItReal(config.Server.ServDir) { //check for Server directory
|
||||
fmt.Printf("PATH NOT FOUND: %s", config.Server.ServDir)
|
||||
return false
|
||||
}
|
||||
if !isItReal(config.Server.WorldFile) { // check for world file
|
||||
fmt.Printf("PATH NOT FOUND: %s", config.Server.WorldFile)
|
||||
return false
|
||||
}
|
||||
if !isItReal(config.Server.ServCfg) { // check for server config
|
||||
fmt.Printf("PATH NOT FOUND: %s", config.Server.ServCfg)
|
||||
return false
|
||||
}
|
||||
if !isItReal(config.Server.ServExec) { // check for server exec file to lanch server
|
||||
fmt.Printf("PATH NOT FOUND: %s", config.Server.ServExec)
|
||||
return false
|
||||
}
|
||||
if !isItReal(config.Factoryman.BackupDir) { // check for backup directory
|
||||
fmt.Printf("PATH NOT FOUND: %s", config.Factoryman.BackupDir)
|
||||
return false
|
||||
}
|
||||
|
||||
if config.Factoryman.ApiToken == "" || config.Factoryman.UserName == "" {
|
||||
fmt.Printf("API Token/Username not set (to download mods add api token and username to config)")
|
||||
}
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user