mirror of https://github.com/status-im/op-geth.git
common: remove windows path functions
They were unused and their tests failed on Windows.
This commit is contained in:
parent
b23b4dbd79
commit
78b101e15d
|
@ -478,7 +478,7 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager {
|
||||||
}
|
}
|
||||||
|
|
||||||
func IpcSocketPath(ctx *cli.Context) (ipcpath string) {
|
func IpcSocketPath(ctx *cli.Context) (ipcpath string) {
|
||||||
if common.IsWindows() {
|
if runtime.GOOS == "windows" {
|
||||||
ipcpath = common.DefaultIpcPath()
|
ipcpath = common.DefaultIpcPath()
|
||||||
if ctx.GlobalIsSet(IPCPathFlag.Name) {
|
if ctx.GlobalIsSet(IPCPathFlag.Name) {
|
||||||
ipcpath = ctx.GlobalString(IPCPathFlag.Name)
|
ipcpath = ctx.GlobalString(IPCPathFlag.Name)
|
||||||
|
|
|
@ -116,14 +116,3 @@ func DefaultIpcPath() string {
|
||||||
}
|
}
|
||||||
return filepath.Join(DefaultDataDir(), "geth.ipc")
|
return filepath.Join(DefaultDataDir(), "geth.ipc")
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsWindows() bool {
|
|
||||||
return runtime.GOOS == "windows"
|
|
||||||
}
|
|
||||||
|
|
||||||
func WindonizePath(path string) string {
|
|
||||||
if string(path[0]) == "/" && IsWindows() {
|
|
||||||
path = path[1:]
|
|
||||||
}
|
|
||||||
return path
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
// Copyright 2014 The go-ethereum Authors
|
|
||||||
// This file is part of the go-ethereum library.
|
|
||||||
//
|
|
||||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
|
||||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
package common
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
// "testing"
|
|
||||||
|
|
||||||
checker "gopkg.in/check.v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type CommonSuite struct{}
|
|
||||||
|
|
||||||
var _ = checker.Suite(&CommonSuite{})
|
|
||||||
|
|
||||||
func (s *CommonSuite) TestOS(c *checker.C) {
|
|
||||||
expwin := (os.PathSeparator == '\\' && os.PathListSeparator == ';')
|
|
||||||
res := IsWindows()
|
|
||||||
|
|
||||||
if !expwin {
|
|
||||||
c.Assert(res, checker.Equals, expwin, checker.Commentf("IsWindows is", res, "but path is", os.PathSeparator))
|
|
||||||
} else {
|
|
||||||
c.Assert(res, checker.Not(checker.Equals), expwin, checker.Commentf("IsWindows is", res, "but path is", os.PathSeparator))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *CommonSuite) TestWindonziePath(c *checker.C) {
|
|
||||||
iswindowspath := os.PathSeparator == '\\'
|
|
||||||
path := "/opt/eth/test/file.ext"
|
|
||||||
res := WindonizePath(path)
|
|
||||||
ressep := string(res[0])
|
|
||||||
|
|
||||||
if !iswindowspath {
|
|
||||||
c.Assert(ressep, checker.Equals, "/")
|
|
||||||
} else {
|
|
||||||
c.Assert(ressep, checker.Not(checker.Equals), "/")
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -40,7 +40,7 @@ func (s *SizeSuite) TestStorageSizeString(c *checker.C) {
|
||||||
c.Assert(StorageSize(data3).String(), checker.Equals, exp3)
|
c.Assert(StorageSize(data3).String(), checker.Equals, exp3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommonSuite) TestCommon(c *checker.C) {
|
func (s *SizeSuite) TestCommon(c *checker.C) {
|
||||||
ether := CurrencyToString(BigPow(10, 19))
|
ether := CurrencyToString(BigPow(10, 19))
|
||||||
finney := CurrencyToString(BigPow(10, 16))
|
finney := CurrencyToString(BigPow(10, 16))
|
||||||
szabo := CurrencyToString(BigPow(10, 13))
|
szabo := CurrencyToString(BigPow(10, 13))
|
||||||
|
|
Loading…
Reference in New Issue