Skip to content

Commit 1e8baee

Browse files
committed
multi: use filepath instead of path to work on Windows
This commit fixes an issue with file system paths on Windows. The path package is only intended to be used with URIs or non file system paths. For anything OS dependent, filepath should be used instead.
1 parent 5191872 commit 1e8baee

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"net"
99
"net/http"
1010
"os"
11-
"path"
1211
"path/filepath"
1312
"strings"
1413
"time"
@@ -620,7 +619,7 @@ func validateRemoteModeConfig(cfg *Config) error {
620619
r.Lnd.MacaroonPath = filepath.Join(
621620
defaultLndCfg.DataDir, defaultLndChainSubDir,
622621
defaultLndChain, cfg.Network,
623-
path.Base(defaultLndCfg.AdminMacPath),
622+
filepath.Base(defaultLndCfg.AdminMacPath),
624623
)
625624
}
626625

itest/server_harness.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"io/ioutil"
66
"net"
7-
"path"
7+
"path/filepath"
88
"sync"
99
"time"
1010

@@ -57,8 +57,8 @@ func (s *serverHarness) start() error {
5757
return err
5858
}
5959

60-
s.certFile = path.Join(tempDirName, "proxy.cert")
61-
keyFile := path.Join(tempDirName, "proxy.key")
60+
s.certFile = filepath.Join(tempDirName, "proxy.cert")
61+
keyFile := filepath.Join(tempDirName, "proxy.key")
6262
creds, err := genCertPair(s.certFile, keyFile)
6363
if err != nil {
6464
return err

terminal.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"net"
1212
"net/http"
1313
"os"
14-
"path"
1514
"path/filepath"
1615
"regexp"
1716
"strings"
@@ -216,7 +215,7 @@ func (g *LightningTerminal) Run() error {
216215
)
217216
g.sessionRpcServer, err = newSessionRPCServer(&sessionRpcServerConfig{
218217
basicAuth: g.rpcProxy.basicAuth,
219-
dbDir: path.Join(g.cfg.LitDir, g.cfg.Network),
218+
dbDir: filepath.Join(g.cfg.LitDir, g.cfg.Network),
220219
grpcOptions: []grpc.ServerOption{
221220
grpc.CustomCodec(grpcProxy.Codec()), // nolint: staticcheck,
222221
grpc.ChainStreamInterceptor(
@@ -424,7 +423,7 @@ func (g *LightningTerminal) startSubservers() error {
424423
hex.EncodeToString(macData),
425424
))
426425
clientOptions = append(
427-
clientOptions, lndclient.MacFilename(path.Base(macPath)),
426+
clientOptions, lndclient.MacFilename(filepath.Base(macPath)),
428427
)
429428

430429
// If we're in integrated mode, we can retrieve the macaroon string
@@ -447,7 +446,7 @@ func (g *LightningTerminal) startSubservers() error {
447446
// subservers have the same requirements.
448447
var err error
449448
g.basicClient, err = lndclient.NewBasicClient(
450-
host, tlsPath, path.Dir(macPath), string(network),
449+
host, tlsPath, filepath.Dir(macPath), string(network),
451450
clientOptions...,
452451
)
453452
return err
@@ -571,7 +570,7 @@ func (g *LightningTerminal) startSubservers() error {
571570

572571
g.macaroonService, err = lndclient.NewMacaroonService(
573572
&lndclient.MacaroonServiceConfig{
574-
DBPath: path.Join(g.cfg.LitDir, g.cfg.Network),
573+
DBPath: filepath.Join(g.cfg.LitDir, g.cfg.Network),
575574
MacaroonLocation: "litd",
576575
StatelessInit: !createDefaultMacaroons,
577576
RequiredPerms: litPermissions,
@@ -1352,8 +1351,8 @@ func (g *LightningTerminal) showStartupInfo() error {
13521351
// alias. But the wallet might be locked.
13531352
host, network, tlsPath, macPath, _ := g.cfg.lndConnectParams()
13541353
basicClient, err := lndclient.NewBasicClient(
1355-
host, tlsPath, path.Dir(macPath), string(network),
1356-
lndclient.MacFilename(path.Base(macPath)),
1354+
host, tlsPath, filepath.Dir(macPath), string(network),
1355+
lndclient.MacFilename(filepath.Base(macPath)),
13571356
)
13581357
if err != nil {
13591358
return fmt.Errorf("error querying remote node: %v", err)

0 commit comments

Comments
 (0)