rebuilt command flag system

This commit is contained in:
2026-05-07 17:38:28 -06:00
parent 3d24198ad3
commit 283ffb66eb
8 changed files with 105 additions and 220 deletions

View File

@@ -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
}