|
Atrinik Client 1.0
|
00001 # Simple script to assist in updating project files for CodeBlocks and 00002 # VisualC when new files are added/removed. 00003 00004 import os 00005 00006 directory = "../../src" 00007 fp_cb = open("codeblocks.txt", "w") 00008 vc_data = {} 00009 00010 def scan(directory): 00011 nodes = os.listdir(directory) 00012 00013 for node in nodes: 00014 path = directory + "/" + node 00015 00016 if os.path.isdir(path): 00017 if not "zlib" in path: 00018 vc_data[node] = [] 00019 00020 scan(path) 00021 elif os.path.isfile(path): 00022 if node == "define.h": 00023 continue 00024 00025 if path[-2:] == ".c" or path[-2:] == ".h": 00026 new_path = path.replace("/", "\\") 00027 fp_cb.write("\n\t\t<Unit filename=\"..\{0}\">\n\t\t\t<Option compilerVar=\"CC\" />\n\t\t</Unit>".format(new_path)) 00028 00029 if not "zlib" in new_path: 00030 if path[-2:] == ".h": 00031 vc_data["include"].append(new_path) 00032 else: 00033 vc_data[os.path.basename(os.path.dirname(path))].append(new_path) 00034 00035 scan(directory) 00036 fp_cb.close() 00037 00038 fp_vc = open("visualc-include.txt", "w") 00039 fp_vc.write("\n\t\t<Filter\n\t\t\tName=\"Header Files\"\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\"\n\t\t\t>") 00040 vc_data["include"].sort() 00041 00042 for f in vc_data["include"]: 00043 fp_vc.write("\n\t\t\t<File\n\t\t\t\tRelativePath=\"..\{0}\"\n\t\t\t\t>\n\t\t\t</File>".format(f)) 00044 00045 fp_vc.write("\n\t\t</Filter>") 00046 fp_vc.close() 00047 00048 fp_vc = open("visualc-source.txt", "w") 00049 fp_vc.write("\n\t\t<Filter\n\t\t\tName=\"Source Files\"\n\t\t\tFilter=\"cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx\"\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\"\n\t\t\t>") 00050 00051 for d in vc_data: 00052 if d == "include": 00053 continue 00054 00055 vc_data[d].sort() 00056 fp_vc.write("\n\t\t\t<Filter\n\t\t\t\tName=\"{0}\"\n\t\t\t\t>".format(d)) 00057 00058 for f in vc_data[d]: 00059 fp_vc.write("\n\t\t\t\t<File\n\t\t\t\t\tRelativePath=\"..\{0}\"\n\t\t\t\t\t>".format(f)) 00060 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Debug|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tObjectFile=\"$(IntDir)\{0}\\\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(d)) 00061 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Debug|x64\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tObjectFile=\"$(IntDir)\{0}\\\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(d)) 00062 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Release|Win32\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tObjectFile=\"$(IntDir)\{0}\\\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(d)) 00063 fp_vc.write("\n\t\t\t\t\t<FileConfiguration\n\t\t\t\t\t\tName=\"Release|x64\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<Tool\n\t\t\t\t\t\t\tName=\"VCCLCompilerTool\"\n\t\t\t\t\t\t\tObjectFile=\"$(IntDir)\{0}\\\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FileConfiguration>".format(d)) 00064 fp_vc.write("\n\t\t\t\t</File>") 00065 00066 fp_vc.write("\n\t\t\t</Filter>") 00067 00068 fp_vc.write("\n\t\t</Filter>") 00069 fp_vc.close()
1.7.4