Commit 3aa64120 authored by Jan Kiene's avatar Jan Kiene
Browse files

fix file modes and default to posix path prints for diff-compat

parent 39d0f2e0
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -32,11 +32,12 @@ from hashlib import md5


def get_hash_line_for_file(file: Path, experiment_dir: Path):
    with open(file, "b") as f:
    with open(file, "rb") as f:
        hash = md5(f.read()).hexdigest()

    filepath = file.relative_to(experiment_dir)
    hashline = f"{str(filepath)} {hash}"
    # always print forward slashes even on windows to be able to diff the result files
    hashline = f"{str(filepath.as_posix())} {hash}\n"

    return hashline

@@ -46,7 +47,7 @@ def main(experiment_dir, out_file):

    hashlines = [get_hash_line_for_file(f, experiment_dir) for f in wav_files]

    with open(out_file) as f:
    with open(out_file, "w") as f:
        f.writelines(hashlines)