diff --git a/cmd/rename.go b/cmd/rename.go index 5ad92567..59e8877e 100644 --- a/cmd/rename.go +++ b/cmd/rename.go @@ -3,8 +3,8 @@ package cmd import ( "fmt" "os" - "path/filepath" + "github.com/0chain/gosdk/core/pathutil" "github.com/0chain/gosdk/zboxcore/sdk" "github.com/spf13/cobra" ) @@ -38,7 +38,7 @@ var renameCmd = &cobra.Command{ } remotePath := cmd.Flag("remotepath").Value.String() destName := cmd.Flag("destname").Value.String() - oldName := filepath.Base(remotePath) + oldName := pathutil.Dir(remotePath) if oldName == destName { fmt.Println(remotePath + " renamed") return diff --git a/cmd/share.go b/cmd/share.go index fd72642d..0b6f7348 100644 --- a/cmd/share.go +++ b/cmd/share.go @@ -3,10 +3,10 @@ package cmd import ( "fmt" "os" - "path/filepath" "time" "github.com/0chain/gosdk/core/common" + "github.com/0chain/gosdk/core/pathutil" "github.com/0chain/gosdk/zboxcore/fileref" "github.com/0chain/gosdk/zboxcore/sdk" "github.com/spf13/cobra" @@ -70,7 +70,7 @@ var shareCmd = &cobra.Command{ var fileName string - _, fileName = filepath.Split(remotepath) + _, fileName = pathutil.Split(remotepath) refereeClientID := cmd.Flag("clientid").Value.String() revoke, _ := cmd.Flags().GetBool("revoke") diff --git a/cmd/upload.go b/cmd/upload.go index 63a46382..104de200 100644 --- a/cmd/upload.go +++ b/cmd/upload.go @@ -2,11 +2,11 @@ package cmd import ( "os" - "path/filepath" "strings" "sync" thrown "github.com/0chain/errors" + "github.com/0chain/gosdk/core/pathutil" "github.com/0chain/gosdk/zboxcore/sdk" "github.com/0chain/gosdk/zboxcore/zboxutil" "github.com/0chain/zboxcli/util" @@ -168,7 +168,7 @@ func fullPathAndFileNameForUpload(localPath, remotePath string) (string, string, } fullRemotePath := zboxutil.GetFullRemotePath(localPath, remotePath) - _, fileName := filepath.Split(fullRemotePath) + _, fileName := pathutil.Split(fullRemotePath) return fullRemotePath, fileName, nil } diff --git a/go.mod b/go.mod index 3c4a94eb..cc665a6d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/0chain/errors v1.0.3 - github.com/0chain/gosdk v1.8.15-0.20230324003013-f8040f52bd92 + github.com/0chain/gosdk v1.8.15-0.20230324074439-e95aedb29c87 github.com/icza/bitio v1.1.0 github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.6.0 diff --git a/go.sum b/go.sum index 67ed9cb9..30720e98 100644 --- a/go.sum +++ b/go.sum @@ -40,8 +40,8 @@ github.com/0chain/common v0.0.6-0.20221123040931-4a3feacdb97c h1:TDqF7VJa7uLLlEs github.com/0chain/common v0.0.6-0.20221123040931-4a3feacdb97c/go.mod h1:OxV9kVgVzAPgGHHPcS/aUSL2ZxNvKDU6jPoggKMbqns= github.com/0chain/errors v1.0.3 h1:QQZPFxTfnMcRdt32DXbzRQIfGWmBsKoEdszKQDb0rRM= github.com/0chain/errors v1.0.3/go.mod h1:xymD6nVgrbgttWwkpSCfLLEJbFO6iHGQwk/yeSuYkIc= -github.com/0chain/gosdk v1.8.15-0.20230324003013-f8040f52bd92 h1:1yzlfh9EPDWb3BgHCgYAfufNAEc7Q4o2WDWYPIITLLI= -github.com/0chain/gosdk v1.8.15-0.20230324003013-f8040f52bd92/go.mod h1:cBm7vTDxG+QvWb3SAnsYaOnLkBhUXc5UmtJn/QfVWKI= +github.com/0chain/gosdk v1.8.15-0.20230324074439-e95aedb29c87 h1:bJpPhWlCv0a1nMKneWZT/GUurRLB4EPuWf2mRMEiPNc= +github.com/0chain/gosdk v1.8.15-0.20230324074439-e95aedb29c87/go.mod h1:cBm7vTDxG+QvWb3SAnsYaOnLkBhUXc5UmtJn/QfVWKI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Luzifer/go-openssl/v3 v3.1.0 h1:QqKqo6kYXGGUsvtUoCpRZm8lHw+jDfhbzr36gVj+/gw=