PDA

View Full Version : Problems with DeleteDir



danjal
03-04-2008, 07:12 AM
I have a InstallScript MSI Project.
I am trying during uninstallation to delete the folder with my product, but it does not work. Here is my script code.

STRING szPath, szPath2;
…..

szPath2 = FOLDER_PROGRAMS;
StrRemoveLastSlash(szPath2);
ChangeDirectory(szPath2);

szPath = INSTALLDIR;
StrRemoveLastSlash(szPath);
DeleteDir(szPath, ALLCONTENTS);

What am I doing wrong?

bryanwolf
03-04-2008, 02:13 PM
Where is it failing?

What are the return values of the functions you're calling?

danjal
03-05-2008, 04:55 AM
ChangeDirectory returns 0
DeleteDir returns -1

What is failing is that the directory that I am trying to delete does not get deleted.

I have no problem deleting the directory manually.

The code runs under OnMaintUIAfter.