From c63b1dc190482f1bd55cce55c0859798eabc60b7 Mon Sep 17 00:00:00 2001 From: kayomn Date: Sat, 24 Dec 2022 01:50:14 +0000 Subject: [PATCH] Fix deployment update bugs --- manager.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/manager.go b/manager.go index 0e2c371..0fb2e51 100644 --- a/manager.go +++ b/manager.go @@ -74,9 +74,8 @@ func (game *Game) Deploy(names []string) error { for _, zipFile := range zipReadCloser.File { var deployPath = filepath.Join(game.Path, zipFile.Name) - var fileMode = zipFile.Mode() - if dirError := os.MkdirAll(filepath.Dir(deployPath), fileMode); dirError != nil { + if dirError := os.MkdirAll(filepath.Dir(deployPath), os.ModePerm); dirError != nil { return dirError } @@ -91,10 +90,6 @@ func (game *Game) Deploy(names []string) error { var backupPath = filepath.Join( cachePath(), game.Name, "overwritten", zipFile.Name) - if dirError := os.MkdirAll(filepath.Dir(backupPath), os.ModePerm); dirError != nil { - return dirError - } - if renameError := os.Rename(deployPath, backupPath); renameError != nil { return renameError } @@ -439,8 +434,10 @@ func (game *Game) RenameMod(modName string, newName string) error { var modsDirPath = filepath.Join(configPath(), game.Name) - if renameError := os.Rename(filepath.Join(modsDirPath, modName), - filepath.Join(modsDirPath, newName)); renameError != nil { + if renameError := os.Rename(fmt.Sprintf("%s.%s", + filepath.Join(modsDirPath, modName), mod.Format), + fmt.Sprintf("%s.%s", filepath.Join( + modsDirPath, newName), mod.Format)); renameError != nil { return renameError }