-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7471754
commit fe1df3a
Showing
3 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
__all__ = ["to_bin"] | ||
|
||
from loguru import logger | ||
import subprocess | ||
import os | ||
import shutil | ||
|
||
from skypy.const.loc import BIN_FOLDER, WAZA_SCHEMA, FILENAME_WAZA | ||
|
||
|
||
def to_bin( | ||
output_dir: str = BIN_FOLDER, | ||
waza_schema: str = WAZA_SCHEMA, | ||
) -> None: | ||
"""Creates the waza.bin file.""" | ||
# Ensure output directory exists | ||
os.makedirs(output_dir, exist_ok=True) | ||
|
||
# Command to execute | ||
command = [ | ||
"flatc", | ||
"-b", | ||
waza_schema, | ||
os.path.join(output_dir, FILENAME_WAZA), | ||
] | ||
|
||
# Run the command | ||
subprocess.run(command, check=False) | ||
|
||
# Example: Copy the generated binary file to another directory | ||
output_binary_path = os.path.join(output_dir, "personal_array.bin") | ||
shutil.copy(os.path.join(output_dir, "personal_array.json"), output_binary_path) | ||
|
||
print(f"Binary file copied to {output_binary_path}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters