Archive: Issues with Find* commands


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.


Have you used FindClose?
Is the custom page callback function called?
Are you sure your guinea pig has files in that directory?


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....

Can you please attach the script?


Originally posted by kichik
Can you please attach the script?
The custom function starts at line 318...
Thanks =)

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:


I maintain that the code is still in dev which accounts for all the hideous commands =)


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
>

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...

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.


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...


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.


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).

which suprisingly does not matter since I open the the correct file a little later, and perform the writes from there.