# HG changeset patch # User Edouard Tisserant # Date 1653462778 -7200 # Node ID bd4be02fe102a88462651839bce828600ebc3989 # Parent f422d3d71f89aab466cd2006ca13249831cf448d IDE: fix permission checking on windows for IDE project directory. diff -r f422d3d71f89 -r bd4be02fe102 util/misc.py --- a/util/misc.py Mon May 23 18:12:30 2022 +0200 +++ b/util/misc.py Wed May 25 09:12:58 2022 +0200 @@ -28,7 +28,8 @@ from __future__ import absolute_import -import os +import os,sys +import random from functools import reduce from util.BitmapLibrary import AddBitmapFolder @@ -42,9 +43,18 @@ for root, dirs, files in os.walk(path): files = [f for f in files if not f[0] == '.'] dirs[:] = [d for d in dirs if not d[0] == '.'] - if os.access(root, os.W_OK) is not True: - return False - for name in dirs + files: + if sys.platform.startswith('win'): + try: + testdirpath = os.path.join(root, "testdir_", random.randint(0, 4294967296)) + os.mkdir(testdirpath) + os.rmmir(testdirpath) + except: + return False + else: + if os.access(root, os.W_OK) is not True: + return False + + for name in files: if os.access(os.path.join(root, name), os.W_OK) is not True: return False return True