[mojosetup] Uninstall, but keep some files

Ryan C. Gordon icculus at icculus.org
Thu Feb 5 01:16:11 EST 2009


> Our software creates a couple of files during setup (after
> installation), which we would like to keep also after an uninstall. The
> problem is that the uninstall fails when it tries to remove a directory
> which is not empty. Is there a way to make the uninstaller continue,
> without warnings after a failed rmdir?

In most cases, an app shouldn't write files to an app's install 
directory. It's just good policy on modern operating systems.


The quick (but imperfect) fix is this:

In mojosetup_mainline.lua, go find...

    local function uninstaller()

... and in there, is a line like this:

    delete_files(filelist, callback, true)

Make that "true" into "false".

Now deletion errors will not cause the installer to panic. It will 
delete what it can, and not complain about the rest.


In the long term, we should probably either just ignore non-empty 
directories on uninstall, or have a way to note in config.lua that 
specific ones may have leftover files.

--ryan.




More information about the mojosetup mailing list