Skip to content

Commit 6aecd24

Browse files
committed
Fix AttributeError: 'CCPluginCompile' object has no attribute 'project_name'
1 parent 01814f0 commit 6aecd24

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
@@ -1341,10 +1341,13 @@ def build_linux(self):
13411341
self.project_name = cfg_obj.project_name
13421342
else:
13431343
f = open(os.path.join(cmakefile_dir, 'CMakeLists.txt'), 'r')
1344+
regexp_set_app_name = re.compile(r'\s*set\s*\(\s*APP_NAME', re.IGNORECASE)
13441345
for line in f.readlines():
1345-
if "set(APP_NAME " in line:
1346-
self.project_name = re.search('APP_NAME ([^\)]+)\)', line).group(1)
1346+
if regexp_set_app_name.search(line):
1347+
self.project_name = re.search('APP_NAME ([^\)]+)\)', line, re.IGNORECASE).group(1)
13471348
break
1349+
if hasattr(self, 'project_name') == False:
1350+
raise cocos.CCPluginError("Cauldn't find APP_NAME in CMakeLists.txt")
13481351

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

0 commit comments

Comments
 (0)