diff --git a/windows/build.iss b/windows/build.iss index b9ac6b0..b202416 100644 --- a/windows/build.iss +++ b/windows/build.iss @@ -24,8 +24,8 @@ DisableProgramGroupPage=yes ; Uncomment the following line to run in non administrative install mode (install for current user only.) ;PrivilegesRequired=lowest PrivilegesRequiredOverridesAllowed=dialog -OutputDir=C:\Users\wgh19\IdeaProjects\pixes\build\windows -OutputBaseFilename=pixes-windows-installer +OutputDir={#RootPath}\build\windows +OutputBaseFilename=pixes-{#MyAppVersion}-windows-installer SetupIconFile={#RootPath}\windows\runner\resources\app_icon.ico Compression=lzma SolidCompression=yes @@ -35,7 +35,7 @@ ArchitecturesAllowed=x64 arm64 [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" -Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl" +Name: "chinesesimplified"; MessagesFile: "{#RootPath}\windows\ChineseSimplified.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked diff --git a/windows/build_windows.py b/windows/build.py similarity index 50% rename from windows/build_windows.py rename to windows/build.py index 68b6320..4f2da6b 100644 --- a/windows/build_windows.py +++ b/windows/build.py @@ -1,17 +1,18 @@ import subprocess import os +import httpx -os.chdir(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +file = open('pubspec.yaml', 'r') +content = file.read() +file.close() subprocess.run(["flutter", "build", "windows"], shell=True) -if os.path.exists("build/app-windows.zip"): - os.remove("build/app-windows.zip") +version = str.split(str.split(content, 'version: ')[1], '+')[0] -subprocess.run(["tar", "-a", "-c", "-f", "build/windows/x64/app-windows.zip", "-C", "build/windows/x64/runner/Release", "."] +subprocess.run(["tar", "-a", "-c", "-f", f"build/windows/pixes-{version}-windows.zip", "-C", "build/windows/x64/runner/Release", "*"] , shell=True) -version = str.split(str.split(content, 'version: ')[1], '+')[0] issContent = "" file = open('windows/build.iss', 'r') issContent = file.read() @@ -23,7 +24,14 @@ file = open('windows/build.iss', 'w') file.write(newContent) file.close() +if not os.path.exists("windows/ChineseSimplified.isl"): + # download ChineseSimplified.isl + url = "https://raw.githubusercontent.com/kira-96/Inno-Setup-Chinese-Simplified-Translation/refs/heads/main/ChineseSimplified.isl" + response = httpx.get(url) + with open('windows/ChineseSimplified.isl', 'wb') as file: + file.write(response.content) + subprocess.run(["iscc", "windows/build.iss"], shell=True) with open('windows/build.iss', 'w') as file: - file.write(issContent) \ No newline at end of file + file.write(issContent) \ No newline at end of file