def copy_crt_dll(configuration): if configuration == 'Release': crt_dll_dir = fs.path(util.msvc.vc_install_dir) / 'redist' / 'x86' / 'Microsoft.VC100.CRT' else: return if fs.exists(crt_dll_dir): fs.copy_directory(crt_dll_dir, path['ResultCore'], ['.dll'])
def copy_crt_dll(msvc_version, configuration): if configuration == 'Release': crt_dll_dir = fs.path(util.msvc.vc_install_dir) / 'redist' / 'x86' / ('Microsoft.VC' + str(msvc_version) + '.CRT') else: return if fs.exists(crt_dll_dir): fs.copy_directory(crt_dll_dir, path['ResultCore'], ['.dll'])
def GetDirectoryNameOfFileAbove(p, f): p = fs.path(p) while True: if fs.exists(p / f): return p p.remove_filename() if p.filename() == '': break return None
def convert_file(from_ptah, to_path, file_name): in_file = open(str(from_ptah / file_name), 'rb') out_file = open(str(to_path / fs.path(file_name).replace_extension('.txt')), 'wb') reobj = re.compile(br'([\s\S]*?)(\/\/[\s\S]*)') try: for line in in_file.readlines(): m = reobj.search(line) if m: line = m.group(1).decode('cp936').encode('utf-8') + m.group(2) else: line = line.decode('cp936').encode('utf-8') out_file.write(line) finally: in_file.close() out_file.close()
def convert_file(from_ptah, to_path, file_name): in_file = open(str(from_ptah / file_name), 'rb') out_file = open( str(to_path / fs.path(file_name).replace_extension('.txt')), 'wb') reobj = re.compile(br'([\s\S]*?)(\/\/[\s\S]*)') try: for line in in_file.readlines(): m = reobj.search(line) if m: line = m.group(1).decode('cp936').encode('utf-8') + m.group(2) else: line = line.decode('cp936').encode('utf-8') out_file.write(line) finally: in_file.close() out_file.close()