@@ -482,7 +482,27 @@ def set_console_root(self):
482
482
self .set_windows_path (cocos_consle_root )
483
483
484
484
self ._force_update_env (COCOS_CONSOLE_ROOT , cocos_consle_root )
485
+ def set_cocos_x_root (self ):
486
+ print ("->Check environment variable %s" % COCOS_X_ROOT )
487
+ cocos_x_root = os .path .dirname (self .current_absolute_path )
488
+ old_dir = self ._find_environment_variable (COCOS_X_ROOT )
489
+ if old_dir is None :
490
+ # add environment variable
491
+ if self ._isWindows ():
492
+ self .set_windows_path (cocos_x_root )
493
+
494
+ self ._set_environment_variable (COCOS_X_ROOT , cocos_x_root )
495
+ else :
496
+ if old_dir == cocos_x_root :
497
+ # is same with before, nothing to do
498
+ return
499
+
500
+ # update the environment variable
501
+ if self ._isWindows ():
502
+ self .remove_dir_from_win_path (old_dir )
503
+ self .set_windows_path (cocos_x_root )
485
504
505
+ self ._force_update_env (COCOS_X_ROOT , cocos_x_root )
486
506
def set_templates_root (self ):
487
507
print ("->Check environment variable %s" % COCOS_TEMPLATES_ROOT )
488
508
cocos_templates_root = os .path .join (self .current_absolute_path , 'templates' )
@@ -663,6 +683,7 @@ def set_environment_variables(self, ndk_root, android_sdk_root, ant_root):
663
683
self .file_used_for_setup = self ._get_filepath_for_setup ()
664
684
665
685
self .set_console_root ()
686
+ self .set_cocos_x_root ()
666
687
self .set_templates_root ()
667
688
668
689
if self ._isWindows ():
0 commit comments