Added Fujitsu SFX BIOS Extractor v3.0_a2

Fixed deletion of folders with read-only files

Fixed missing README > Requirement for VAIO Packaging Manager Extractor
This commit is contained in:
platomav 2022-07-14 01:32:25 +03:00
parent df47293d01
commit 48562b0f68
4 changed files with 194 additions and 4 deletions

View file

@ -8,6 +8,7 @@ Copyright (C) 2022 Plato Mavropoulos
import os
import re
import sys
import stat
import shutil
from pathlib import Path, PurePath
@ -92,7 +93,12 @@ def make_dirs(in_path, parents=True, exist_ok=False, delete=False):
# Delete folder(s), if present
def del_dirs(in_path):
if Path(in_path).is_dir():
shutil.rmtree(in_path)
shutil.rmtree(in_path, onerror=clear_readonly)
# Clear read-only file attribute (on shutil.rmtree error)
def clear_readonly(in_func, in_path, _):
os.chmod(in_path, stat.S_IWRITE)
in_func(in_path)
# Walk path to get all files
def get_path_files(in_path):