Refactor to store Base64 data in a separate Python file

Moved Base64 strings for executable and icon into a dedicated Python module (base64_strings.py) instead of text files, enhancing code organization. Updated main.py to import Base64 strings from the new module. Also replaced placeholder program name 'DeinProgrammName' with 'Toolbox' throughout the installer scripts.
This commit is contained in:
2024-12-09 22:09:51 +01:00
parent cb6cbe4352
commit 5a2ddd031b
2 changed files with 18 additions and 16 deletions

View File

@@ -10,11 +10,9 @@ def encode_file_to_base64(file_path):
exe_base64 = encode_file_to_base64("D:/Repos/toolbox/cmake-build-release-visual-studio/Toolbox.exe")
icon_base64 = encode_file_to_base64("D:/Repos/toolbox/cmake-build-release-visual-studio/toolbox.ico")
# Base64-Strings in Textdateien schreiben
with open("Toolbox_exe_base64.txt", 'w') as exe_file:
exe_file.write(exe_base64)
# Base64-Strings in eine Python-Datei schreiben
with open("base64_strings.py", 'w') as py_file:
py_file.write(f'exe_base64 = """{exe_base64}"""\n\n')
py_file.write(f'icon_base64 = """{icon_base64}"""\n\n')
with open("Toolbox_icon_base64.txt", 'w') as icon_file:
icon_file.write(icon_base64)
print("Base64-Daten erfolgreich in Textdateien gespeichert.")
print("Base64-Daten erfolgreich in die Python-Datei gespeichert.")