Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't set different names to app axecutable and app folder. #4056

Closed
Zver64 opened this issue Jul 15, 2019 · 4 comments
Closed

Can't set different names to app axecutable and app folder. #4056

Zver64 opened this issue Jul 15, 2019 · 4 comments
Labels

Comments

@Zver64
Copy link

Zver64 commented Jul 15, 2019

  • Version: 20.44.4
  • Target: windows

I have following configuration in my packaje.json file:

"build": {
    "productName": "MyApp",
    "appId": "com.myApp",
    "directories": {
      "output": "build"
    },
    "files": [
      "dist/electron/**/*"
    ],
    "win": {
      "icon": "build/icons/icon.ico",
      "requestedExecutionLevel": "requireAdministrator"
    },
    "nsis": {
      "oneClick": false,
      "perMachine": true,
      "allowToChangeInstallationDirectory": true
    }

When I install my app on windows, I see the following default instalation path:
.../Program Files/MyApp
If I don't change it, then all files wil be installed in this folder and the executable name woild be MyApp.exe. If i change the installation path, for example, to this:
.../Program Files/CustomFolder
then all files will be installed into **.../Program Files/CustomFolder/MyApp/ and the executable file will remain MyApp.exe.
There are two things I wan't to change:

  1. I want to have different name for app folder and app executable. For example folder name: MyApp, executable name: myAwesomeApp.exe, so after I install my app into default path it would be /Program Files/MyApp/MyAwesomeApp.exe
  2. If I change the path to .../Program Files/CustomFolder - I don't want to create MyApp subfolder in it.
@Zver64
Copy link
Author

Zver64 commented Jul 17, 2019

And also I found an interesting behavior. I figured out that if the folder where you want to install your app doesn't exist yet, then the app will be installed in it directly. If this folder exists and even if it is empty - there would be created another folder inside of it named same as productName property in the package.json. In my case it is MyApp.
But there is more. Let's say I have installed my app in "C:\testFolder". If I try to install the app again - it will automatically find the previous installation path and suggest it to me. And if I click yes, it will first uninstall previously installed app and install it again. But. I have custom "customRemoveFiles" script that does not remove the app folder, which means the folder "C:\testFolder" still exist when the app is about to be installed again. So it creates a subfolder named MyApp, as described above.
I guess I should use custom installation script or something like that? I am not good at writing these scripts and there is not much to read about custom scripts in the documentation of electron-builder, so maybe someone knows where I can find default scripts that are used in electron-builder. Any help would be much appreciated.

@Zver64
Copy link
Author

Zver64 commented Jul 22, 2019

I think a found a piece of code responsible for creating a subfolder. It is in node_modules/app-builder-lib/templates/nsis/assistedInstaller.nsh starting at line 43 in my version of electron-builder which is currentrly 20.44.4.
Here is the code:

!define MUI_PAGE_CUSTOMFUNCTION_PRE instFilesPre

    # sanitize the MUI_PAGE_DIRECTORY result to make sure it has a application name sub-folder
    Function instFilesPre
      ${If} ${FileExists} "$INSTDIR\*"
        ${StrContains} $0 "${APP_FILENAME}" $INSTDIR
        ${If} $0 == ""
          StrCpy $INSTDIR "$INSTDIR\${APP_FILENAME}"
        ${endIf}
      ${endIf}
    FunctionEnd

It would be great if this was optional and also had a configurable folder name. And also I think it would be better if it would check the path even if it doesn't exist yet.

@srepollock
Copy link

Is there any other way to change the application name for the outputted files? (.app, .exe, .deb)?

@stale
Copy link

stale bot commented Nov 8, 2019

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Nov 8, 2019
@stale stale bot closed this as completed Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants