diff options
author | Felix Lange <fjl@twurst.com> | 2015-08-06 22:15:36 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-08-06 22:43:43 +0800 |
commit | 78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2 (patch) | |
tree | abe044da849d214eaa8db9c0c13a7ea273bc0d2d | |
parent | b23b4dbd79b4699abde4b3954c7480e137ffc3be (diff) | |
download | dexon-78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2.tar dexon-78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2.tar.gz dexon-78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2.tar.bz2 dexon-78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2.tar.lz dexon-78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2.tar.xz dexon-78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2.tar.zst dexon-78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2.zip |
common: remove windows path functions
They were unused and their tests failed on Windows.
-rw-r--r-- | cmd/utils/flags.go | 2 | ||||
-rw-r--r-- | common/path.go | 11 | ||||
-rw-r--r-- | common/path_test.go | 52 | ||||
-rw-r--r-- | common/size_test.go | 2 |
4 files changed, 2 insertions, 65 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 815d48124..cf969805d 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -478,7 +478,7 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager { } func IpcSocketPath(ctx *cli.Context) (ipcpath string) { - if common.IsWindows() { + if runtime.GOOS == "windows" { ipcpath = common.DefaultIpcPath() if ctx.GlobalIsSet(IPCPathFlag.Name) { ipcpath = ctx.GlobalString(IPCPathFlag.Name) diff --git a/common/path.go b/common/path.go index 0d7adb961..8b3c7d14b 100644 --- a/common/path.go +++ b/common/path.go @@ -116,14 +116,3 @@ func DefaultIpcPath() string { } 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 -} diff --git a/common/path_test.go b/common/path_test.go deleted file mode 100644 index 71ffd5fe1..000000000 --- a/common/path_test.go +++ /dev/null @@ -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), "/") - } -} diff --git a/common/size_test.go b/common/size_test.go index 8709a0237..ce19cab69 100644 --- a/common/size_test.go +++ b/common/size_test.go @@ -40,7 +40,7 @@ func (s *SizeSuite) TestStorageSizeString(c *checker.C) { 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)) finney := CurrencyToString(BigPow(10, 16)) szabo := CurrencyToString(BigPow(10, 13)) |