'Why file being created in electron-builder install process is being removed from the installation user folder?
While adding a script to run in the process of installation, I see the file I'm writing into being deleted or removed from the installation directory. Why?
my vue.config.js file:
pluginOptions: {
electronBuilder: {
builderOptions: {
appId: 'test.com',
win: {
"target": ["nsis"]
},
"nsis": {
"include": "build/installer.nsh",
"oneClick": false,
"allowToChangeInstallationDirectory": true
}
}
}
}
my script create new file and write inside user name/password:
my installer.nsh file:
!include nsDialogs.nsh
!include LogicLib.nsh
XPStyle on
Var Dialog
Var UserLabel
Var UserText
Var UserState
Var PassLabel
Var PassText
Var PassState
Page custom nsDialogsPage nsDialogsPageLeave
Function nsDialogsPage
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Your Username:"
Pop $UserLabel
${NSD_CreateText} 0 13u 100% 12u $UserState
Pop $UserText
${NSD_CreateLabel} 0 39u 100% 12u "Your Password:"
Pop $PassLabel
${NSD_CreatePassword} 0 52u 100% 12u $PassState
Pop $PassText
nsDialogs::Show
FunctionEnd
Function nsDialogsPageLeave
${NSD_GetText} $UserText $UserState
${NSD_GetText} $PassText $PassState
${If} $UserState == ""
MessageBox MB_OK "Username is missing."
Abort
${EndIf}
${If} $PassState == ""
MessageBox MB_OK "Password is missing."
Abort
${EndIf}
StrCpy $1 $UserState
StrCpy $2 $PassState
FunctionEnd
Section
SetOutPath "$INSTDIR\myfolder"
FileOpen $9 $INSTDIR\myfolder\credentials.txt w
FileWrite $9 "$1 $2"
FileClose $9
SectionEnd
While running the setup.exe file I can see it creates "myfolder" and also creates the "credentials.txt" file and update it, but when the process ends - the folder stays empty. The file was removed. Why? What I'm missing here?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
