equal
deleted
inserted
replaced
26 Misc definitions |
26 Misc definitions |
27 """ |
27 """ |
28 |
28 |
29 |
29 |
30 from __future__ import absolute_import |
30 from __future__ import absolute_import |
31 import os |
31 import os,sys |
|
32 import random |
32 from functools import reduce |
33 from functools import reduce |
33 |
34 |
34 from util.BitmapLibrary import AddBitmapFolder |
35 from util.BitmapLibrary import AddBitmapFolder |
35 from util.TranslationCatalogs import AddCatalog |
36 from util.TranslationCatalogs import AddCatalog |
36 |
37 |
40 if path is None or not os.path.isdir(path): |
41 if path is None or not os.path.isdir(path): |
41 return False |
42 return False |
42 for root, dirs, files in os.walk(path): |
43 for root, dirs, files in os.walk(path): |
43 files = [f for f in files if not f[0] == '.'] |
44 files = [f for f in files if not f[0] == '.'] |
44 dirs[:] = [d for d in dirs if not d[0] == '.'] |
45 dirs[:] = [d for d in dirs if not d[0] == '.'] |
45 if os.access(root, os.W_OK) is not True: |
46 if sys.platform.startswith('win'): |
46 return False |
47 try: |
47 for name in dirs + files: |
48 testdirpath = os.path.join(root, "testdir_", random.randint(0, 4294967296)) |
|
49 os.mkdir(testdirpath) |
|
50 os.rmmir(testdirpath) |
|
51 except: |
|
52 return False |
|
53 else: |
|
54 if os.access(root, os.W_OK) is not True: |
|
55 return False |
|
56 |
|
57 for name in files: |
48 if os.access(os.path.join(root, name), os.W_OK) is not True: |
58 if os.access(os.path.join(root, name), os.W_OK) is not True: |
49 return False |
59 return False |
50 return True |
60 return True |
51 |
61 |
52 |
62 |