Page 1 of 1
Edit ini Line->Remove not working
Posted: Tue May 18, 2010 9:40 am
by 5aclockshadow
Can anyone tell me why?
Text:
--------------------------------------------------------
Edit INI File $TARGETDIR$\Visitor Watch Reports\Reports.ini, [Report33] NumberOfFields=
--------------------------------------------------------
Code:
---------------------------------------------------------
~InstallAware Clipboard Data~
~Edit INI File~
~{023454EC-71A1-49C7-97CD-21BDE39EBE0A}~
~$TARGETDIR$\Visitor Watch Reports~
~Reports.ini~
~2~
~Report33~
~NumberOfFields~
~~
---------------------------------------------------------
Re: Edit ini Line->Remove not working
Posted: Tue May 18, 2010 10:47 am
by 5aclockshadow
Little more info:
My understanding is that setting Edit ini action to Line->Remove should actually delete the line...so when set to NumberOfFields (I also tried NumberOfFields=2) it should remove/delete the line.
So from this:
[Report33]
ButtonName=<empty>
NumberOfFields=2
FieldName0=Start Date:
FieldType0=Date
FieldName1=End Date:
FieldType1=Date
ReportName=rptByDateRangePhoto.lst
To this:
[Report33]
ButtonName=<empty>
FieldName0=Start Date:
FieldType0=Date
FieldName1=End Date:
FieldType1=Date
ReportName=rptByDateRangePhoto.lst
Is this correct or am I missing something???
Re: Edit ini Line->Remove not working
Posted: Tue May 18, 2010 3:50 pm
by MichaelNesmith
Are you actually testing for the deletion after Apply Install executes?
Re: Edit ini Line->Remove not working
Posted: Tue May 18, 2010 6:28 pm
by 5aclockshadow
Not sure what you mean...all the code is above/before the Apply Install.
I run the setup on a test PC and when I open the ini file the line is still there.
I can get Line->Create or Update to work just fine...if I run the code below it changes "NumberOfFields=2" to "NumberOfFields=". But how can I get the "NumberOfFields" line to be removed/deleted?
Text:
--------------------------------------------------------
Edit INI File $TARGETDIR$\Visitor Watch Reports\Reports.ini, [Report33] NumberOfFields=
--------------------------------------------------------
Code:
---------------------------------------------------------
~InstallAware Clipboard Data~
~Edit INI File~
~{023454EC-71A1-49C7-97CD-21BDE39EBE0A}~
~$TARGETDIR$\Visitor Watch Reports~
~Reports.ini~
~0~
~Report33~
~NumberOfFields~
~~
---------------------------------------------------------
Thanks for the help.
Re: Edit ini Line->Remove not working
Posted: Tue May 18, 2010 7:53 pm
by MichaelNesmith
What I am asking is - is the removal not happening even after Apply Install has been called?
Re: Edit ini Line->Remove not working
Posted: Fri May 21, 2010 1:36 pm
by 5aclockshadow
Correct, the removal is not happening even after Apply Install has been called.
I run the setup on a test PC and when I open the ini file the line is still there.
Is there some other way to test this by stepping through the code?
Thanks again.
Re: Edit ini Line->Remove not working
Posted: Fri May 21, 2010 4:49 pm
by MichaelNesmith
That's odd. Can you send us a reproducing test project that doesn't reference any other files on your system but just illustrates this alleged bug? I will try to reproduce and escalate to R&D for resolution, or if it is some kind of user error, get back to you with a solution.
Re: Edit ini Line->Remove not working
Posted: Tue Jun 01, 2010 11:43 am
by 5aclockshadow
Michael Nesmith wrote:
"I see the problem. You are installing and editing the INI file at the same time, this is what is causing the confusion. I would manually copy the INI file using Call DLL Function on kernel32.dll's CopyFileA and then process the INI edits."
5aclockshadow wrote:
"Ok, thank you I will try that.
One question though, how come the 'Line->Create or Update' action works?"
Michael Nesmith wrote:
"Because lines are deleted first, then files are copied, and then lines are updated. So that one will work."
5aclockshadow wrote:
"I think I got it working so thanks for all the help!
However, I do have 2 quick questions:
1.) Now the uninstall doesn't uninstall the copied file (and therefore $TARGETDIR$ doesn't get uninstalled). Any suggestions?
2.) I don't understand this statement: "Because lines are deleted first, then files are copied, and then lines are updated."
Based on this comment I tried to run the edit ini statement that deletes lines first using $SUPPORTDIR$ for the location. I did this before 'Apply Install'.
Second, I copied the file after 'Apply Install' (from $SUPPORTDIR$ to $TARGETDIR$).
Third, I ran the edit ini statement that updates lines using $TARGETDIR$ for the location.
My results were that the update statement didn't work. Once I moved the update statement "up above the 'Apply Install' w/ the delete statement" then it did work.
So is the order:
1. lines are deleted & updated
2. files are copied
???
If so, then how come the update worked in my original setup w/o CopyFileA?"
Michael Nesmith wrote:
"Apply Install redoes the entire install cycle including commands from the previous cycle, so files may get overwritten and entries re-written.
I'd Edit the INI file directly from $SUPPORTDIR$ and after Apply Install copy it over to the destination.
You can add a Delete Files statement before your Apply Install (not Apply Uninstall, read the help file topic "setup commands preceding Apply Uninstall" for a related discussion) with the "delete on uninstall" flag to remove the file explicitly at uninstall time,
Thanks..."
5aclockshadow wrote:
"Sounds great. Again thanks for all the help!"