util/misc.py
changeset 1719 704c7036db85
parent 1511 91538d0c242c
child 1732 94ffe74e6895
equal deleted inserted replaced
1718:703ddaf48b00 1719:704c7036db85
    31 # helper func to check path write permission
    31 # helper func to check path write permission
    32 def CheckPathPerm(path):
    32 def CheckPathPerm(path):
    33     if path is None or not os.path.isdir(path):
    33     if path is None or not os.path.isdir(path):
    34         return False
    34         return False
    35     for root, dirs, files in os.walk(path):
    35     for root, dirs, files in os.walk(path):
    36          for name in files:
    36         files = [f for f in files if not f[0] == '.']
    37              if os.access(root, os.W_OK) is not True or os.access(os.path.join(root, name), os.W_OK) is not True:
    37         dirs[:] = [d for d in dirs if not d[0] == '.']
    38                  return False
    38         for name in files:
       
    39             if os.access(root, os.W_OK) is not True or os.access(os.path.join(root, name), os.W_OK) is not True:
       
    40                 return False
    39     return True
    41     return True
    40 
    42 
    41 def GetClassImporter(classpath):
    43 def GetClassImporter(classpath):
    42     if type(classpath)==str:
    44     if type(classpath)==str:
    43         def fac():
    45         def fac():