diff options
author | Janos Guljas <janos@resenje.org> | 2018-09-27 15:43:00 +0800 |
---|---|---|
committer | Janos Guljas <janos@resenje.org> | 2018-09-27 15:43:00 +0800 |
commit | a5e6bf7eefbe6f56cf688b3542fe373c4670cb65 (patch) | |
tree | 8b712ef8fb72b354346c7b1092261c469ebd7d8a /cmd/swarm | |
parent | 0d5e1e7bc9ad4044a679ab5429d118b2a0e8afe7 (diff) | |
parent | e39a9b3480af0ac8044294f46e0e9e4c3948d23c (diff) | |
download | go-tangerine-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar go-tangerine-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.gz go-tangerine-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.bz2 go-tangerine-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.lz go-tangerine-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.xz go-tangerine-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.tar.zst go-tangerine-a5e6bf7eefbe6f56cf688b3542fe373c4670cb65.zip |
Merge branch 'master' into max-stream-peer-servers
Diffstat (limited to 'cmd/swarm')
-rw-r--r-- | cmd/swarm/config.go | 10 | ||||
-rw-r--r-- | cmd/swarm/upload.go | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go index 22b92d214..00978ba26 100644 --- a/cmd/swarm/config.go +++ b/cmd/swarm/config.go @@ -125,7 +125,7 @@ func initSwarmNode(config *bzzapi.Config, stack *node.Node, ctx *cli.Context) { //get the account for the provided swarm account prvkey := getAccount(config.BzzAccount, ctx, stack) //set the resolved config path (geth --datadir) - config.Path = stack.InstanceDir() + config.Path = expandPath(stack.InstanceDir()) //finally, initialize the configuration config.Init(prvkey) //configuration phase completed here @@ -183,7 +183,7 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con if ctx.GlobalIsSet(utils.DataDirFlag.Name) { if datadir := ctx.GlobalString(utils.DataDirFlag.Name); datadir != "" { - currentConfig.Path = datadir + currentConfig.Path = expandPath(datadir) } } @@ -230,6 +230,10 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con if len(ensAPIs) == 1 && ensAPIs[0] == "" { ensAPIs = nil } + for i := range ensAPIs { + ensAPIs[i] = expandPath(ensAPIs[i]) + } + currentConfig.EnsAPIs = ensAPIs } @@ -272,7 +276,7 @@ func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) { } if datadir := os.Getenv(GETH_ENV_DATADIR); datadir != "" { - currentConfig.Path = datadir + currentConfig.Path = expandPath(datadir) } bzzport := os.Getenv(SWARM_ENV_PORT) diff --git a/cmd/swarm/upload.go b/cmd/swarm/upload.go index 9eae2a3f8..f76cb1b98 100644 --- a/cmd/swarm/upload.go +++ b/cmd/swarm/upload.go @@ -138,6 +138,12 @@ func upload(ctx *cli.Context) { // 3. cleans the path, e.g. /a/b/../c -> /a/c // Note, it has limitations, e.g. ~someuser/tmp will not be expanded func expandPath(p string) string { + if i := strings.Index(p, ":"); i > 0 { + return p + } + if i := strings.Index(p, "@"); i > 0 { + return p + } if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") { if home := homeDir(); home != "" { p = home + p[1:] |