Fix deployment update bugs
This commit is contained in:
parent
4613ce055c
commit
c63b1dc190
13
manager.go
13
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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue