2

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:

  1. Using a setTimeout() to delay the rimraf(myLocalAppData) call
  2. Using the maxBusyTries param in the rimraf options to continue retrying for 10 seconds if a EBUSY, ENOTEMPTY, or EPERM error code is encountered when trying to clean up the directory
  3. Running app.exit() before the rimraf(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!

Kevin Lee
  • 1,370
  • 14
  • 22

0 Answers0