Modified compile_to_bin.py to create the data directory if missing

This commit is contained in:
Nicolas Kruse 2025-06-02 16:37:08 +02:00
parent 18b2cbc9da
commit fa14461852
1 changed files with 4 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import yaml import yaml
import struct import struct
import sys import sys
import os
def main(): def main():
@ -53,6 +54,9 @@ def main():
offset += len(body) offset += len(body)
added_list.add(dat['name']) added_list.add(dat['name'])
# Ensure the output directory exists
os.makedirs(os.path.dirname(output_file), exist_ok=True)
with open(output_file, 'wb') as f: with open(output_file, 'wb') as f:
f.write(b'gapy') f.write(b'gapy')
f.write(struct.pack('<I', len(species_names))) f.write(struct.pack('<I', len(species_names)))