Hi,
You can create an exe but I don't know if this solves the Anti Virus problem. However here is some code that could help you:
Code: Select all
void EmptyDirectory(char* folderPath)
{
char fileFound[256];
WIN32_FIND_DATA info;
HANDLE hp;
sprintf(fileFound, "%s\\*.*", folderPath);
hp = FindFirstFile(fileFound, &info);
do
{
if (!((strcmp(info.cFileName, ".")==0)||
(strcmp(info.cFileName, "..")==0)))
{
if((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)==
FILE_ATTRIBUTE_DIRECTORY)
{
string subFolder = folderPath;
subFolder.append("\\");
subFolder.append(info.cFileName);
EmptyDirectory((char*)subFolder.c_str());
RemoveDirectory(subFolder.c_str());
}
else
{
sprintf(fileFound,"%s\\%s", folderPath, info.cFileName);
BOOL retVal = DeleteFile(fileFound);
}
}
} while(FindNextFile(hp, &info));
FindClose(hp);
}
The EmptyDirectory function deletes all files and folders from a specified path. You must specify [APPDIR] property as parameter for the program that uses this function. Here's how the main function looks like:
Code: Select all
char fullPath[MAX_PATH] = "";
for(int i = 1; i < argc; i++)
{
strcat(fullPath, argv[i]);
if(i < argc-1) strcat(fullPath, " ");
}
if(strlen(fullPath)) EmptyDirectory(fullPath);
Here's how to use the exe program as custom action in Advanced Installer:
Switch to the "Custom Action" page and add a "New Attached Custom Action" under the "Uninstall" action and select the created exe. Use the following options for the custom action:
1. Command Line: [APPDIR]
2. Let all the other options to their default values.
Use this code at your own risk.
Regards,
Gigi
_________________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com