OSDN Git Service

Merge pull request #201 from Bytom/v0.1
[bytom/vapor.git] / common / path.go
diff --git a/common/path.go b/common/path.go
deleted file mode 100644 (file)
index 746424d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-package common
-
-import (
-       "fmt"
-       "os"
-       "os/user"
-       "path/filepath"
-       "runtime"
-       "strings"
-)
-
-// MakeName creates a node name that follows the ethereum convention
-// for such names. It adds the operation system name and Go runtime version
-// the name.
-func MakeName(name, version string) string {
-       return fmt.Sprintf("%s/v%s/%s/%s", name, version, runtime.GOOS, runtime.Version())
-}
-
-func ExpandHomePath(p string) (path string) {
-       path = p
-       sep := string(os.PathSeparator)
-
-       // Check in case of paths like "/something/~/something/"
-       if len(p) > 1 && p[:1+len(sep)] == "~"+sep {
-               usr, _ := user.Current()
-               dir := usr.HomeDir
-               path = strings.Replace(p, "~", dir, 1)
-       }
-       return
-}
-
-func FileExist(filePath string) bool {
-       _, err := os.Stat(filePath)
-       if err != nil && os.IsNotExist(err) {
-               return false
-       }
-
-       return true
-}
-
-func AbsolutePath(Datadir string, filename string) string {
-       if filepath.IsAbs(filename) {
-               return filename
-       }
-       return filepath.Join(Datadir, filename)
-}
-
-func HomeDir() string {
-       if home := os.Getenv("HOME"); home != "" {
-               return home
-       }
-       if usr, err := user.Current(); err == nil {
-               return usr.HomeDir
-       }
-       return ""
-}