- NSIS Discussion
- Issues with Find* commands
Archive: Issues with Find* commands
Bud-froggy
27th December 2002 22:13 UTC
Issues with Find* commands
Ok, im lost.
Im using the modern UI and set up a custom page.
Now, this custom page is given a directory, and then searches for all folders in the directory. It then displays all the folders on the custom page.
Now, this function works fine with my computer, but one of my guinea pigs has reported that the FindFirst and FindNext functions, when given a valid directory containing subdirectories, returns '.', '..' and then reports that there is nothing else.
Now, I was messing around with the installer on my system, and if go thru the process until my custom page, and hit back, bringing me to the 'choose installation dir', then next right away (still giving it a good dir), then it skips the entire custom page and goes to the installation, even though it worked the first time around.
kichik
27th December 2002 23:36 UTC
Have you used FindClose?
Is the custom page callback function called?
Are you sure your guinea pig has files in that directory?
Bud-froggy
28th December 2002 14:53 UTC
Originally posted by kichik
Have you used FindClose?
Yes...
Is the custom page callback function called?
As in:
Page custom SetCustomMod "$(TEXT_IO_PAGETITLE)"
?
yes
Are you sure your guinea pig has files in that directory?
Certain... I even ftp'ed in and double checked....
kichik
28th December 2002 14:55 UTC
Can you please attach the script?
Bud-froggy
28th December 2002 21:48 UTC
Originally posted by kichik
Can you please attach the script?
The custom function starts at line 318...
Thanks =)
kichik
28th December 2002 22:18 UTC
I can't test it because I don't have ioMod.ini. Can you please attach that too?
A few things I have noticed from reading the script:
Bud-froggy
29th December 2002 10:57 UTC
I maintain that the code is still in dev which accounts for all the hideous commands =)
kichik
29th December 2002 17:33 UTC
I am pretty sure the problem is with the coding, the errors and warning I have mentioned above. When I ran the installer the first time I got to the custom page it showed Text=Something a lot of times and when I pressed back and then forward again it just skipped it... The IO distortion is caused by mis-using File* and the skipping by mis-checking something there:
IntOp $R8 $R8 - 1 #already loaded for next field
>IntCmp $R8 1 NoMod
>
Bud-froggy
30th December 2002 19:14 UTC
Originally posted by kichik
I am pretty sure the problem is with the coding, the errors and warning I have mentioned above.
I had removed those before uplaoding it for a second time with the ioMod.ini file...
When I ran the installer the first time I got to the custom page it showed Text=Something a lot of times and when I pressed back and then forward again it just skipped it... The IO distortion is caused by mis-using File* and the skipping by mis-checking something there:
IntOp $R8 $R8 - 1 #already loaded for next field
>IntCmp $R8 1 NoMod
>
I dont see how this could be an issue.
The varibale is initialized to 2, meaning that we should start writing to Field 2 in the ioMod.ini...
If the installer encouters a valid directory, it will increment the varibale. At the end, i subtract 1 from it, because i add one at the end of every filewrite toioMod.ini, and if it is equal to 1, its value was never changed, since it was initialized to 2. In this case, I create a new field on my custom page, and output some text telling the user that (s)he did not select a valid directory...
Now, I rewrote everything so that it uses the cute little ini functions (a waste if you ask me, but if it makes you happy...), but the problem persists. I tested it on a friends system with some dummy files, and the process failed miserably. It did not detect any of the valid directories, AND it did not write the error report to the custom page either... In fact, it skipped the custom page entirely. I looked at the ioMod.ini file in the $PLUGINSDIR directory, and it was untouched...
I am off on vacation right now, so I cant do a full test and what not, but I will as soon as i get back. In the meantime, please find attached the script as well as the ioMod.ini file...
kichik
31st December 2002 15:49 UTC
It wasn't a waste at all, you just forgot to add one thing, "$PLUGINSDIR\" ;)
Everywhere you have used WriteIniStr you forgot to add "$PLUGINSDIR\". After I have added this it works perfectly fine for me.
You may also want to only write the INI once so the installer won't have search for the canidates more than once, and so the IO page will "remember" what option was last selected.
Bud-froggy
31st December 2002 17:21 UTC
I added that yesterday and started testing...
Try this: run the installer the first time, then let it idle on the custom page. If you then launch a new instance, the installer will skip the custom page all together and go to the installation part....
I will continue testing once i get home becuase i feel as though i cannot concentrate here...
kichik
31st December 2002 17:46 UTC
This error can be fixed by adding ClearErrors before the FindFirst command in SetCustomMod, line ~340. This means that a error has occured above which you have not checked. It's always a good idea to clear the error flag before you call a command that might set the error flag which you would like to later check.
eccles
1st January 2003 01:47 UTC
In case you haven't found it already, the following line towards the start of Function SetCustomMod has a typo
File /oname=$PLUGINSDIRS\ioMod.ini ioMod.ini
should be $PLUGINSDIR (without trailing S).
Bud-froggy
2nd January 2003 02:13 UTC
which suprisingly does not matter since I open the the correct file a little later, and perform the writes from there.