Home > Net >  Building Electron App in Windows with Different Temporary Folder
Building Electron App in Windows with Different Temporary Folder

Time:01-28

Is there a way to configure the path of temporary folders that get created when I run the installer of an application based on Electron? Instead of ~\AppData\Local\Temp, I'd like to use a different folder, e.g., c:\Temp. The screenshot below shows a temporary folder that gets created as the application installer is running. At the end, all files are deleted but nsProcess.dll. I'd like this folder (and potential others) to be created in a different location.

enter image description here

CodePudding user response:

$Temp in the installer comes from %Temp% set by the system (usually from the registry) and there is generally no need to change it.

If you must, you can do this:

Function .onInit
UnsafeStrCpy $Temp "c:\foo\bar"
CreateDirectory "$Temp"
UnsafeStrCpy $PluginsDir $Temp
Initpluginsdir
FunctionEnd

However, $PluginsDir is normally deleted when the installer quits and if not it usually means something is holding a lock on a file.

In your case, try:

Section "my last section"
...
${nsProcess::Unload}
SectionEnd
  •  Tags:  
  • Related