Skip to content

Commit 2876c68

Browse files
author
Bin Zhang
authored
Fix AttributeError: 'CCPluginCompile' object has no attribute 'project_name' (#367)
Thanks for your contribution!
2 parents 1981123 + 6aecd24 commit 2876c68

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugins/plugin_compile/project_compile.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,10 +1331,13 @@ def build_linux(self):
13311331
self.project_name = cfg_obj.project_name
13321332
else:
13331333
f = open(os.path.join(cmakefile_dir, 'CMakeLists.txt'), 'r')
1334+
regexp_set_app_name = re.compile(r'\s*set\s*\(\s*APP_NAME', re.IGNORECASE)
13341335
for line in f.readlines():
1335-
if "set(APP_NAME " in line:
1336-
self.project_name = re.search('APP_NAME ([^\)]+)\)', line).group(1)
1336+
if regexp_set_app_name.search(line):
1337+
self.project_name = re.search('APP_NAME ([^\)]+)\)', line, re.IGNORECASE).group(1)
13371338
break
1339+
if hasattr(self, 'project_name') == False:
1340+
raise cocos.CCPluginError("Cauldn't find APP_NAME in CMakeLists.txt")
13381341

13391342
if cfg_obj.build_dir is not None:
13401343
build_dir = os.path.join(project_dir, cfg_obj.build_dir)

0 commit comments

Comments
 (0)