Make "findParent" work on Windows properly

Fixes #31
This commit is contained in:
Steve Francia 2015-12-08 21:48:19 -05:00
parent e042b5f805
commit daf7a87d8f
1 changed files with 3 additions and 4 deletions

View File

@ -18,7 +18,6 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"path"
"path/filepath" "path/filepath"
"sort" "sort"
"strings" "strings"
@ -118,8 +117,8 @@ func (m *MemMapFs) unRegisterWithParent(fileName string) {
} }
func (m *MemMapFs) findParent(f File) File { func (m *MemMapFs) findParent(f File) File {
pdir, _ := path.Split(f.Name()) pdir, _ := filepath.Split(f.Name())
pdir = path.Clean(pdir) pdir = filepath.Clean(pdir)
pfile, err := m.lockfreeOpen(pdir) pfile, err := m.lockfreeOpen(pdir)
if err != nil { if err != nil {
return nil return nil
@ -133,7 +132,7 @@ func (m *MemMapFs) registerWithParent(f File) {
} }
parent := m.findParent(f) parent := m.findParent(f)
if parent == nil { if parent == nil {
pdir := filepath.Dir(path.Clean(f.Name())) pdir := filepath.Dir(filepath.Clean(f.Name()))
err := m.lockfreeMkdir(pdir, 0777) err := m.lockfreeMkdir(pdir, 0777)
if err != nil { if err != nil {
//log.Println("Mkdir error:", err) //log.Println("Mkdir error:", err)