ezanelli
01-08-2009, 02:40 PM
I am trying to preserve (i.e. NOT delete during uninstall) the 3 support files IRIMG1.JPG, IRIMG2.JPG and IRIMG3.JPG. Here's my On Post Install action:
local appFolder = SessionVar.Expand( "%AppFolder%" );
local fileName = "";
local uninstallDataItem = "";
fileName = appFolder .. "\\Uninstall\\IRIMG1.JPG";
if ( File.DoesExist( fileName ) ) then
uninstallDataItem = UninstallData.GetItem( UNINDATA_SUPPORTFILES, fileName );
if ( uninstallDataItem ~= nil ) then
UninstallData.RemoveItem( UNINDATA_SUPPORTFILES, fileName );
if ( Application.GetLastError() ~= 0 ) then
Debug.Print( "Error: " .. _tblErrorMessages[Application.GetLastError()] .. "\n" );
else
Debug.Print( "Removed " .. fileName .. ".\n" );
end
else
Debug.Print( fileName .. " is not part of the uninstall configuration.\n" );
end
else
Debug.Print( "File " .. fileName .. " does not exist.\n" );
end
fileName = appFolder .. "\\Uninstall\\IRIMG2.JPG";
if ( File.DoesExist( fileName ) ) then
uninstallDataItem = UninstallData.GetItem( UNINDATA_SUPPORTFILES, fileName );
if ( uninstallDataItem ~= nil ) then
UninstallData.RemoveItem( UNINDATA_SUPPORTFILES, fileName );
if ( Application.GetLastError() ~= 0 ) then
Debug.Print( "Error: " .. _tblErrorMessages[Application.GetLastError()] .. "\n" );
else
Debug.Print( "Removed " .. fileName .. ".\n" );
end
else
Debug.Print( fileName .. " is not part of the uninstall configuration.\n" );
end
else
Debug.Print( "File " .. fileName .. " does not exist.\n" );
end
fileName = appFolder .. "\\Uninstall\\IRIMG3.JPG";
if ( File.DoesExist( fileName ) ) then
uninstallDataItem = UninstallData.GetItem( UNINDATA_SUPPORTFILES, fileName );
if ( uninstallDataItem ~= nil ) then
UninstallData.RemoveItem( UNINDATA_SUPPORTFILES, fileName );
if ( Application.GetLastError() ~= 0 ) then
Debug.Print( "Error: " .. _tblErrorMessages[Application.GetLastError()] .. "\n" );
else
Debug.Print( "Removed " .. fileName .. ".\n" );
end
else
Debug.Print( fileName .. " is not part of the uninstall configuration.\n" );
end
else
Debug.Print( "File " .. fileName .. " does not exist.\n" );
end
When I run the installer, I get the following debug output, which is expected:
Removed C:\Program Files\Doom 3\Uninstall\IRIMG1.JPG.
Removed C:\Program Files\Doom 3\Uninstall\IRIMG2.JPG.
Removed C:\Program Files\Doom 3\Uninstall\IRIMG3.JPG.
However, when I examine the uninstall.xml file, these items are still there.
This is a bug. I have confirmed the ability to remove UNINDATA_FILES items, just not UNINDATA_SUPPORTFILES items.
Please advise.
Thanks, Ed
local appFolder = SessionVar.Expand( "%AppFolder%" );
local fileName = "";
local uninstallDataItem = "";
fileName = appFolder .. "\\Uninstall\\IRIMG1.JPG";
if ( File.DoesExist( fileName ) ) then
uninstallDataItem = UninstallData.GetItem( UNINDATA_SUPPORTFILES, fileName );
if ( uninstallDataItem ~= nil ) then
UninstallData.RemoveItem( UNINDATA_SUPPORTFILES, fileName );
if ( Application.GetLastError() ~= 0 ) then
Debug.Print( "Error: " .. _tblErrorMessages[Application.GetLastError()] .. "\n" );
else
Debug.Print( "Removed " .. fileName .. ".\n" );
end
else
Debug.Print( fileName .. " is not part of the uninstall configuration.\n" );
end
else
Debug.Print( "File " .. fileName .. " does not exist.\n" );
end
fileName = appFolder .. "\\Uninstall\\IRIMG2.JPG";
if ( File.DoesExist( fileName ) ) then
uninstallDataItem = UninstallData.GetItem( UNINDATA_SUPPORTFILES, fileName );
if ( uninstallDataItem ~= nil ) then
UninstallData.RemoveItem( UNINDATA_SUPPORTFILES, fileName );
if ( Application.GetLastError() ~= 0 ) then
Debug.Print( "Error: " .. _tblErrorMessages[Application.GetLastError()] .. "\n" );
else
Debug.Print( "Removed " .. fileName .. ".\n" );
end
else
Debug.Print( fileName .. " is not part of the uninstall configuration.\n" );
end
else
Debug.Print( "File " .. fileName .. " does not exist.\n" );
end
fileName = appFolder .. "\\Uninstall\\IRIMG3.JPG";
if ( File.DoesExist( fileName ) ) then
uninstallDataItem = UninstallData.GetItem( UNINDATA_SUPPORTFILES, fileName );
if ( uninstallDataItem ~= nil ) then
UninstallData.RemoveItem( UNINDATA_SUPPORTFILES, fileName );
if ( Application.GetLastError() ~= 0 ) then
Debug.Print( "Error: " .. _tblErrorMessages[Application.GetLastError()] .. "\n" );
else
Debug.Print( "Removed " .. fileName .. ".\n" );
end
else
Debug.Print( fileName .. " is not part of the uninstall configuration.\n" );
end
else
Debug.Print( "File " .. fileName .. " does not exist.\n" );
end
When I run the installer, I get the following debug output, which is expected:
Removed C:\Program Files\Doom 3\Uninstall\IRIMG1.JPG.
Removed C:\Program Files\Doom 3\Uninstall\IRIMG2.JPG.
Removed C:\Program Files\Doom 3\Uninstall\IRIMG3.JPG.
However, when I examine the uninstall.xml file, these items are still there.
This is a bug. I have confirmed the ability to remove UNINDATA_FILES items, just not UNINDATA_SUPPORTFILES items.
Please advise.
Thanks, Ed