View Full Version : UnisntallData.RemoveItem() question
jassing
02-27-2007, 06:49 PM
I have this code in a "post install" screen
UninstallData.RemoveItem(UNINDATA_SESSIONVARS, "%RawReg2%");
As we don't want to expose the value of "RawReg2" to the user.
However, this variable still shows up in the uninstall.xml file.
How do we go about removing it using this call? I have a LOT of invested time into using this call -- so I'd rather not have to resort to using the xml plugin to remove these entries....
Thanks
-josh
Josh,
I am not totally clear on what the question is. At first glance I would say that you need to expand the session variable but that may not be what you are asking. Please explain further
Adam Kapilik
jassing
02-28-2007, 11:01 AM
TI am not totally clear on what the question is. At first glance I would say that you need to expand the session variable but that may not be what you are asking. Please explain further
Thanks Adam.
When I run thru my installer, the uninstall.xml file contains a session variable "%rawreg2%".
I want this variable removed from the uninstall.xml file -- the reverse of
UninstallData.AddItem()
I didn't ADD it to additem, but assume it's there becuase of the sessionvariable declaration.
So; the question is --
1) How can I remove the specific session variable from uninstall.xml?
B) does UninstallData.RemoveItem() work?
Cheers
-j
I couldn't get this working either. I have logged for a dev to look into. REF:14937
Adam Kapilik
jassing
02-28-2007, 11:43 AM
I couldn't get this working either. I have logged for a dev to look into. REF:14937
Rats.
I don't suppose you have some xml.stuff() code that could remove items based on <name></name>?
-j
Dan Ullman
02-28-2007, 11:57 AM
An xml file is just a text file. You could use something like TextFile.ReadToString and String.Replace on the item in question. No idea what this would do to your uninstall.
jassing
02-28-2007, 12:38 PM
This is the code I came up with.
function uRemoveSessionVar( cName )
local nElements = XML.Count( "SUF70UninstallData/SessionVars", "Var") ;
for x = 1,nElements do
if XML.GetValue("SUF70UninstallData/SessionVars/Var:"..x.."/Name") == cName then
XML.RemoveElement("SUF70UninstallData/SessionVars/Var:"..x);
x=nElements; -- force end of loop
end
end
end
Since I'm removing a lot of variables that just aren't needed in the uninstall;
I do this in my "post install" routine:
if File.DoesExist( UninstallData.GetConfigurationFile() ) then
Application.SetLastError(0);
XML.Load( UninstallData.GetConfigurationFile() );
if Application.GetLastError() ~= 0 then
-- Error loading XML
else
-- Pull elements out.
uRemoveSessionVar( "%RawReg2%" );
XML.Save( UninstallData.GetConfigurationFile() ) ;
end
else
-- File isn't there.
end
Of course, i could make this a lot more useful by including the various values
UNINDATA_SHORTCUTS, UNINDATA_SESSINVAR etc and adjusting the code; but all I care about (for now) is the session var....
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.