Browse Source

auto create non-existing cache directory

fix https://github.com/chrislusf/seaweedfs/issues/1350
pull/1355/head
Chris Lu 5 years ago
parent
commit
bb3e86fbd5
  1. 1
      weed/filesys/wfs.go
  2. 4
      weed/util/file_util.go

1
weed/filesys/wfs.go

@ -89,6 +89,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
},
}
if option.CacheSizeMB > 0 {
os.MkdirAll(option.CacheDir, 0755)
wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB)
grace.OnInterrupt(func() {
wfs.chunkCache.Shutdown()

4
weed/util/file_util.go

@ -49,6 +49,10 @@ func CheckFile(filename string) (exists, canRead, canWrite bool, modTime time.Ti
exists = false
return
}
if err != nil {
glog.Errorf("check %s: %v", filename, err)
return
}
if fi.Mode()&0400 != 0 {
canRead = true
}

Loading…
Cancel
Save