aboutsummaryrefslogtreecommitdiff
path: root/go/util/file_util.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2013-12-09 13:27:09 -0800
committerChris Lu <chris.lu@gmail.com>2013-12-09 13:27:09 -0800
commit11e91bd5497fe5f97392119d5680a7a1b934c2a7 (patch)
tree8969e917344b8c1a4f4a0367c6f14ff6fd60fafb /go/util/file_util.go
parent2e2f426fe28f8e3d94d7d1dee3afde2655425741 (diff)
downloadseaweedfs-11e91bd5497fe5f97392119d5680a7a1b934c2a7.tar.xz
seaweedfs-11e91bd5497fe5f97392119d5680a7a1b934c2a7.zip
mux router cannot handle "/" correctly. switching it off for volume
servers
Diffstat (limited to 'go/util/file_util.go')
-rw-r--r--go/util/file_util.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/go/util/file_util.go b/go/util/file_util.go
new file mode 100644
index 000000000..46e404851
--- /dev/null
+++ b/go/util/file_util.go
@@ -0,0 +1,23 @@
+package util
+
+import (
+ "code.google.com/p/weed-fs/go/glog"
+ "errors"
+ "os"
+)
+
+func TestFolderWritable(folder string) (err error) {
+ fileInfo, err := os.Stat(folder)
+ if err != nil {
+ return err
+ }
+ if !fileInfo.IsDir() {
+ return errors.New("Not a valid folder!")
+ }
+ perm := fileInfo.Mode().Perm()
+ glog.V(0).Infoln("Folder", folder, "Permission:", perm)
+ if 0200&perm != 0 {
+ return nil
+ }
+ return errors.New("Not writable!")
+}