Use filepath everywhere instead of path.{} functions for portability - fixes #656

This commit is contained in:
Harshavardhana
2015-06-18 16:02:34 -07:00
parent 285b1cc5d8
commit 641f07cecf
17 changed files with 94 additions and 80 deletions

View File

@@ -21,7 +21,7 @@ import (
"encoding/hex"
"io"
"os"
"path"
"path/filepath"
"sort"
"strconv"
"strings"
@@ -56,7 +56,7 @@ func createNodeDiskMap(p string) map[string][]string {
nodes := make(map[string][]string)
nodes["localhost"] = make([]string, 16)
for i := 0; i < len(nodes["localhost"]); i++ {
diskPath := path.Join(p, strconv.Itoa(i))
diskPath := filepath.Join(p, strconv.Itoa(i))
if _, err := os.Stat(diskPath); err != nil {
if os.IsNotExist(err) {
os.MkdirAll(diskPath, 0700)
@@ -74,7 +74,7 @@ func createNodeDiskMapFromSlice(paths []string) map[string][]string {
diskPaths := make([]string, len(paths))
nodes := make(map[string][]string)
for i, p := range paths {
diskPath := path.Join(p, strconv.Itoa(i))
diskPath := filepath.Join(p, strconv.Itoa(i))
if _, err := os.Stat(diskPath); err != nil {
if os.IsNotExist(err) {
os.MkdirAll(diskPath, 0700)