anaisbetts / squirrel-flutter

Build installers for your Flutter applications with Squirrel
BSD 3-Clause "New" or "Revised" License
57 stars 13 forks source link

Not working when the app has custom .exe name #7

Open RustamG opened 2 years ago

RustamG commented 2 years ago

Hello.

I want the app .exe file name to be different depending on the environment I build it for (i.e. "App_QA" or "App_DEV", etc.). So I can have multiple apps installed at the same time, pointing to different servers. This can be accomplished by changing the BINARY_NAME in CMakeLists.txt (official manual).

Currently, installer_windows.dart uses name from pubspec.yaml to find the .exe file for changing the icon and render it to nuspec template: https://github.com/anaisbetts/squirrel-flutter/blob/master/bin/installer_windows.dart#L137-L140 https://github.com/anaisbetts/squirrel-flutter/blob/master/bin/installer_windows.dart#L228-L232 https://github.com/anaisbetts/squirrel-flutter/blob/master/bin/installer_windows.dart#L241-L250

So if I change the .exe name, the script doesn't find it:

Unhandled exception:
Exception: Failed to run C:\Users\circleci\AppData\Local\Pub\Cache\git\squirrel-flutter-1fe5861f10d9828411b766b2f7845888a7ac377a\lib\..\vendor\rcedit.exe --set-icon c:\users\circleci\project\app\windows\runner\resources\app_icon.ico c:\users\circleci\project\app\build\windows\runner\Release\app.exe

Fatal error: Unable to load file

#0      runUtil (file:///C:/Users/circleci/AppData/Local/Pub/Cache/git/squirrel-flutter-1fe5861f10d9828411b766b2f7845888a7ac377a/bin/installer_windows.dart:210:5)
<asynchronous suspension>
#1      main (file:///C:/Users/circleci/AppData/Local/Pub/Cache/git/squirrel-flutter-1fe5861f10d9828411b766b2f7845888a7ac377a/bin/installer_windows.dart:239:3)
<asynchronous suspension>
pub finished with exit code 255

Exited with code exit status 255

The best solution for me would be able to pass the arguments to the script via command line.

aMarkSide commented 8 months ago

Same problem here, but with just updating my CMakeLists.txt to set BINARY_NAME to a different name for my .exe (from "old_name" to "newname"). In order to work around this issue, I had to change the "name" field in pubspec.yaml (and then update all my includes in all my files).