Currently I have an installer built with Squirrel.Windows. On uninstall, the application directory under:
C:\Users\Me\AppData\Local\MyApplicationDirectory
remains. I have tried using rimraf under the the --squirrel-uninstall
hook to remove the directory, but it fails because the files are in use.
Here is what I have that is not working:
case '--squirrel-uninstall':
var myLocalAppData = "C:\\Users\\Me\\AppData\\Local\\MyApplication";
rimraf(myLocalAppData);
app.quit();
I have tried the following to no avail:
- Using a
setTimeout()
to delay therimraf(myLocalAppData)
call - Using the
maxBusyTries
param in the rimraf options to continue retrying for 10 seconds if aEBUSY
,ENOTEMPTY
, orEPERM
error code is encountered when trying to clean up the directory - Running
app.exit()
before therimraf(myLocalAppData)
I know the NSIS installer provided by electron-builder properly cleans up the app data directory, but I cannot use it as I need a MSI to support machine wide installations via Group Policy Management.
Any help is appreciated!