[Script Invincible 2]python get Cocos 2dx project file list

Source: Internet
Author: User
Tags glob

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.