It will be used when porting Cocos 2dx code to Android JNI, so take it away if necessary, free~~
#-*-CODING:GBK-*-# function: Get a list of CPP files for the Cocos 2DX project, use # Input: Project path # output:txt format CPP file list when porting to Android import time, OS, sy Simport globprint ' input project path: ' File_path_input = Raw_input () # file_path_input = ' D:\cocos2d-x-3.3rc0\projects\ ProjectName ' # project root path/file path print File_path_inputfile_type = ' *.cpp ' # file format file_path = file_path_input + ' \\Classes\\ ' cpp_l ist = Glob.glob (File_path + file_type) Cpp_list_len = Len (cpp_list) If Cpp_list_len = = 0:print ' \n--no file--' Sys.ex It () Cpp_filename = ' cpp_list.txt ' F = open (Cpp_filename, ' WT ') IND = 0for item in Cpp_list:item = Item.replace (file_path , ') PRINT Item IND = IND + 1 if ind < Cpp_list_len:item = '. /.. /classes/' + item + ' \ \ ' Else:item = '. /.. /classes/' + Item F.write (item) f.write (' \ n ') f.close () # Open list file Os.system ("explorer.exe%s"% cpp_filename) Android_pro Ject_path = file_path_input + ' \proj.android\jni\android.mk ' Print android_project_path# open the Android Jni folder Os.system (" Explorer.exe%s "% Android_project_path)
[Script Invincible 2]python get Cocos 2dx project file list