1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-05-20 16:36:46 +08:00

fix: use path instead of filepath for asset embeds to support Windows

This commit is contained in:
Adin Schmahmann
2022-05-04 18:47:13 -04:00
parent b72125522a
commit 1299bcb3fd

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"io" "io"
"io/fs" "io/fs"
"path/filepath" gopath "path"
"strconv" "strconv"
"github.com/ipfs/go-ipfs/core" "github.com/ipfs/go-ipfs/core"
@ -27,13 +27,13 @@ var AssetHash string
// initDocPaths lists the paths for the docs we want to seed during --init // initDocPaths lists the paths for the docs we want to seed during --init
var initDocPaths = []string{ var initDocPaths = []string{
filepath.Join("init-doc", "about"), gopath.Join("init-doc", "about"),
filepath.Join("init-doc", "readme"), gopath.Join("init-doc", "readme"),
filepath.Join("init-doc", "help"), gopath.Join("init-doc", "help"),
filepath.Join("init-doc", "contact"), gopath.Join("init-doc", "contact"),
filepath.Join("init-doc", "security-notes"), gopath.Join("init-doc", "security-notes"),
filepath.Join("init-doc", "quick-start"), gopath.Join("init-doc", "quick-start"),
filepath.Join("init-doc", "ping"), gopath.Join("init-doc", "ping"),
} }
func init() { func init() {
@ -91,7 +91,7 @@ func addAssetList(nd *core.IpfsNode, l []string) (cid.Cid, error) {
return cid.Cid{}, err return cid.Cid{}, err
} }
fname := filepath.Base(p) fname := gopath.Base(p)
basePath, err = api.Object().AddLink(nd.Context(), basePath, fname, fp) basePath, err = api.Object().AddLink(nd.Context(), basePath, fname, fp)
if err != nil { if err != nil {