Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update function dump_part, no more erros with file .img not exists #75

Open
josezanatta1961 opened this issue Feb 7, 2025 · 0 comments

Comments

@josezanatta1961
Copy link

def dump_part(part):
sys.stdout.write("Processing %s partition" % part.partition_name)
sys.stdout.flush()

out_file = open('%s/%s.img' % (args.out, part.partition_name), 'wb')
h = hashlib.sha256()

if args.diff:
    old_img_path = '%s/%s.img' % (args.old, part.partition_name)
    # Verifica se o arquivo existe, se não existir, cria um arquivo vazio
    if not os.path.exists(old_img_path):
        open(old_img_path, 'wb').close()
    
    old_file = open(old_img_path, 'rb')
else:
    old_file = None

for op in part.operations:
    data = data_for_op(op,out_file,old_file)
    sys.stdout.write(".")
    sys.stdout.flush()

print("Done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant