skip hidden files and directories on permission check
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 28 Jul 2017 15:34:11 +0300
changeset 1719 704c7036db85
parent 1718 703ddaf48b00
child 1720 f974476b16bb
skip hidden files and directories on permission check

To fix problems with git, because .git subdirectory contains
read-only repository objects.
util/misc.py
--- a/util/misc.py	Fri Jul 14 18:26:20 2017 +0300
+++ b/util/misc.py	Fri Jul 28 15:34:11 2017 +0300
@@ -33,9 +33,11 @@
     if path is None or not os.path.isdir(path):
         return False
     for root, dirs, files in os.walk(path):
-         for name in files:
-             if os.access(root, os.W_OK) is not True or os.access(os.path.join(root, name), os.W_OK) is not True:
-                 return False
+        files = [f for f in files if not f[0] == '.']
+        dirs[:] = [d for d in dirs if not d[0] == '.']
+        for name in files:
+            if os.access(root, os.W_OK) is not True or os.access(os.path.join(root, name), os.W_OK) is not True:
+                return False
     return True
 
 def GetClassImporter(classpath):