Check if build_tools path exists before listdir

This commit is contained in:
Jochen Sprickerhof 2020-11-29 10:02:30 +01:00
parent 1c7df94e76
commit ce10fcb759

View file

@ -498,6 +498,7 @@ def find_sdk_tools_cmd(cmd):
if config is not None and 'sdk_path' in config and os.path.exists(config['sdk_path']):
# try to find a working path to this command, in all the recent possible paths
build_tools = os.path.join(config['sdk_path'], 'build-tools')
if os.path.isdir(build_tools):
for f in sorted(os.listdir(build_tools), reverse=True):
if os.path.isdir(os.path.join(build_tools, f)):
tooldirs.append(os.path.join(build_tools, f))