forked from TrueCloudLab/frostfs-node
[#1132] *: Use path/filepath
package when working with files
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
0decb95591
commit
674f520da7
20 changed files with 73 additions and 77 deletions
|
@ -9,7 +9,7 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/native"
|
||||
|
@ -370,11 +370,11 @@ func (c *initializeContext) readContracts(names []string) error {
|
|||
if c.ContractPath != "" && fi.IsDir() {
|
||||
for _, ctrName := range names {
|
||||
cs := new(contractState)
|
||||
cs.RawNEF, err = ioutil.ReadFile(path.Join(c.ContractPath, ctrName, ctrName+"_contract.nef"))
|
||||
cs.RawNEF, err = ioutil.ReadFile(filepath.Join(c.ContractPath, ctrName, ctrName+"_contract.nef"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't read NEF file for %s contract: %w", ctrName, err)
|
||||
}
|
||||
cs.RawManifest, err = ioutil.ReadFile(path.Join(c.ContractPath, ctrName, "config.json"))
|
||||
cs.RawManifest, err = ioutil.ReadFile(filepath.Join(c.ContractPath, ctrName, "config.json"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't read manifest file for %s contract: %w", ctrName, err)
|
||||
}
|
||||
|
@ -449,8 +449,8 @@ func readContractsFromArchive(file io.Reader, names []string) (map[string]*contr
|
|||
break
|
||||
}
|
||||
|
||||
dir, _ := path.Split(h.Name)
|
||||
ctrName := path.Base(dir)
|
||||
dir, _ := filepath.Split(h.Name)
|
||||
ctrName := filepath.Base(dir)
|
||||
|
||||
cs, ok := m[ctrName]
|
||||
if !ok {
|
||||
|
@ -458,7 +458,7 @@ func readContractsFromArchive(file io.Reader, names []string) (map[string]*contr
|
|||
}
|
||||
|
||||
switch {
|
||||
case strings.HasSuffix(h.Name, path.Join(ctrName, ctrName+"_contract.nef")):
|
||||
case strings.HasSuffix(h.Name, filepath.Join(ctrName, ctrName+"_contract.nef")):
|
||||
cs.RawNEF, err = ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't read NEF file for %s contract: %w", ctrName, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue