diff --git a/src/handlers.go b/src/handlers.go index 10e0355..b357244 100644 --- a/src/handlers.go +++ b/src/handlers.go @@ -52,7 +52,7 @@ func ListInstalledMods(w http.ResponseWriter, r *http.Request) { // Toggles mod passed in through mod variable // Updates mod-list.json file to toggle the enabled status of mods -func ToggleMod(w http.ResponseWriter, r *http.Request) { +/*func ToggleMod(w http.ResponseWriter, r *http.Request) { var err error resp := JSONResponse{ Success: false, @@ -88,10 +88,10 @@ func ToggleMod(w http.ResponseWriter, r *http.Request) { if err = json.NewEncoder(w).Encode(resp); err != nil { log.Printf("Error in toggle mod: %s", err) } -} +}*/ // Returns JSON response of all mods in the mod-list.json file -func ListMods(w http.ResponseWriter, r *http.Request) { +/*func ListMods(w http.ResponseWriter, r *http.Request) { var err error resp := JSONResponse{ Success: false, @@ -113,7 +113,7 @@ func ListMods(w http.ResponseWriter, r *http.Request) { if err := json.NewEncoder(w).Encode(resp); err != nil { log.Printf("Error listing mods: %s", err) } -} +}*/ // Uploads mod to the mods directory func UploadMod(w http.ResponseWriter, r *http.Request) { @@ -165,7 +165,7 @@ func UploadMod(w http.ResponseWriter, r *http.Request) { } } -func RemoveMod(w http.ResponseWriter, r *http.Request) { +/*func RemoveMod(w http.ResponseWriter, r *http.Request) { var err error resp := JSONResponse{ Success: false, @@ -193,7 +193,7 @@ func RemoveMod(w http.ResponseWriter, r *http.Request) { } return } -} +}*/ func DownloadMod(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json;charset=UTF-8") @@ -208,7 +208,7 @@ func DownloadMod(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, modFile) } -func CreateModPackHandler(w http.ResponseWriter, r *http.Request) { +/*func CreateModPackHandler(w http.ResponseWriter, r *http.Request) { var err error resp := JSONResponse{ Success: false, @@ -251,9 +251,9 @@ func CreateModPackHandler(w http.ResponseWriter, r *http.Request) { log.Printf("Error listing saves: %s", err) } } -} +}*/ -func ListModPacks(w http.ResponseWriter, r *http.Request) { +/*func ListModPacks(w http.ResponseWriter, r *http.Request) { var err error resp := JSONResponse{ Success: false, @@ -276,7 +276,7 @@ func ListModPacks(w http.ResponseWriter, r *http.Request) { if err := json.NewEncoder(w).Encode(resp); err != nil { log.Printf("Error listing saves: %s", err) } -} +}*/ func DownloadModPack(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json;charset=UTF-8") @@ -291,7 +291,7 @@ func DownloadModPack(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, modFile) } -func DeleteModPack(w http.ResponseWriter, r *http.Request) { +/*func DeleteModPack(w http.ResponseWriter, r *http.Request) { var err error resp := JSONResponse{ Success: false, @@ -318,7 +318,7 @@ func DeleteModPack(w http.ResponseWriter, r *http.Request) { log.Printf("Error removing modpack: %s", err) } } -} +}*/ // Lists all save files in the factorio/saves directory func ListSaves(w http.ResponseWriter, r *http.Request) { diff --git a/src/main.go b/src/main.go index a56591c..e5c7a0c 100644 --- a/src/main.go +++ b/src/main.go @@ -98,7 +98,7 @@ func main() { // Load server config from file loadServerConfig(config.ConfFile) // Create mod pack dir if missing - createModPackDir() + //createModPackDir() FIXME // Initialize Factorio Server struct FactorioServ, err = initFactorio() diff --git a/src/mods.go b/src/mods.go index bb1a611..a3df27c 100644 --- a/src/mods.go +++ b/src/mods.go @@ -4,7 +4,6 @@ import ( "io/ioutil" "log" "encoding/json" - "fmt" "os" ) @@ -20,18 +19,18 @@ func listInstalledMods(modDir string) ([]Mod, error) { file, err := ioutil.ReadFile(modDir + "mod-list.json") if err != nil { - fmt.Println(err.Error()) + log.Println(err.Error()) os.Exit(1) } err_json := json.Unmarshal(file, &result) if err_json != nil { - fmt.Println(err.Error()) + log.Println(err.Error()) os.Exit(1) } - fmt.Printf("%v", result) + log.Printf("%v", result) //files, err := ioutil.ReadDir(modDir)