INNER CODE UNIT · Python
copy_13
casualsnek/waydroid_script · stuff/gapps.py:157
def copy_13(self):
src_dir = os.path.join(self.extract_to, "system")
dst_dir = os.path.join(self.copy_dir, self.partition)
for root, dirs, files in os.walk(src_dir):
dir_name = os.path.basename(root)
# 遍历文件
for file in files:
src_file_path = os.path.join(root, file)
dst_file_path = os.path.join(dst_dir, os.path.relpath(
src_file_path, src_dir))
if not os.path.exists(os.path.dirname(dst_file_path)):
os.makedirs(os.path.dirname(dst_file_path))
# Logger.info(f"{src_file_path} -> {dst_file_path}")
shutil.copy2(src_file_path, dst_file_path)
if os.path.splitext(dst_file_path)[1].lower() == ".apk":
self.extract_app_lib(dst_file_path)