Skip to content

Commit

Permalink
just noticed some declarations getting shadowed, fix that
Browse files Browse the repository at this point in the history
  • Loading branch information
xubiod committed Jun 13, 2023
1 parent c20eb26 commit 652cc29
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions rgssad.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (rpg *RGSSAD) ExtractFile(archivedFile RPGMakerArchivedFile, outputDirector

for _, itm := range subDirectories {
outputPath = filepath.Join(outputPath, itm)
err := os.Mkdir(outputPath, os.ModeDir)
err = os.Mkdir(outputPath, os.ModeDir)
_, err2 := os.Stat(filepath.Dir(outputPath))

if os.IsNotExist(err) && os.IsNotExist(err2) {
Expand All @@ -107,8 +107,9 @@ func (rpg *RGSSAD) ExtractFile(archivedFile RPGMakerArchivedFile, outputDirector
return
}

if _, err := os.Stat(outputPath); os.IsNotExist(err) || overwriteExisting {
finalFile, err := os.Create(outputPath)
if _, err = os.Stat(outputPath); os.IsNotExist(err) || overwriteExisting {
var finalFile *os.File
finalFile, err = os.Create(outputPath)

if err != nil {
return
Expand All @@ -132,7 +133,7 @@ func (rpg *RGSSAD) ExtractFile(archivedFile RPGMakerArchivedFile, outputDirector
// Returns nil on success, error otherwise.
func (rpg *RGSSAD) ExtractAllFiles(outputDirectoryPath string, overrideExisting bool) (err error) {
for _, archivedFile := range rpg.ArchivedFiles {
err := rpg.ExtractFile(archivedFile, outputDirectoryPath, overrideExisting, true)
err = rpg.ExtractFile(archivedFile, outputDirectoryPath, overrideExisting, true)
if err != nil {
return err
}
Expand Down

0 comments on commit 652cc29

Please sign in to comment.