mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-09 01:56:47 -05:00
Revert "Fix golang-ci gocritic error"
This commit is contained in:
parent
c8ef8cf2a4
commit
67eb1cc103
@ -4,7 +4,6 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/fs"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -182,26 +181,24 @@ func (mpq *MPQ) Size() uint32 {
|
|||||||
func openIgnoreCase(mpqPath string) (*os.File, error) {
|
func openIgnoreCase(mpqPath string) (*os.File, error) {
|
||||||
// First see if file exists with specified case
|
// First see if file exists with specified case
|
||||||
mpqFile, err := os.Open(mpqPath) //nolint:gosec // Will fix later
|
mpqFile, err := os.Open(mpqPath) //nolint:gosec // Will fix later
|
||||||
if err != nil {
|
if err == nil {
|
||||||
mpqName := filepath.Base(mpqPath)
|
return mpqFile, err
|
||||||
mpqDir := filepath.Dir(mpqPath)
|
|
||||||
|
|
||||||
var files []fs.FileInfo
|
|
||||||
files, err = ioutil.ReadDir(mpqDir)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, file := range files {
|
|
||||||
if strings.EqualFold(file.Name(), mpqName) {
|
|
||||||
mpqName = file.Name()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return os.Open(filepath.Join(mpqDir, mpqName)) //nolint:gosec // Will fix later
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mpqFile, err
|
mpqName := filepath.Base(mpqPath)
|
||||||
|
mpqDir := filepath.Dir(mpqPath)
|
||||||
|
|
||||||
|
files, err := ioutil.ReadDir(mpqDir)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, file := range files {
|
||||||
|
if strings.EqualFold(file.Name(), mpqName) {
|
||||||
|
mpqName = file.Name()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return os.Open(filepath.Join(mpqDir, mpqName)) //nolint:gosec // Will fix later
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user