Archive: File not extracted to pluginsdir everytime?


File not extracted to pluginsdir everytime?
I have a text file which I extract to the plugins dir when my installer starts up in the .onInit function as show here,

File "/oname=$PLUGINSDIR\ReleaseNotes.txt" "MyReleaseNotes.txt"

I have a custom page at the end of my installer in which the user can select to view this text file or not. However sometimes the text file does not open. I get an error message telling me the text file does not exist.

Interstingly enough, I have another similar call in .onInit that DOES work everytime. It's a bitmap which I display on the same final custom page.

File "/oname=$PLUGINSDIR\StartFinishImage.bmp" "MyBitmap.bmp"

The only difference between the two files is there type and name but the syntax shold still be the same shouldn't it? Any suggestions, I figure I'm just forgetting to do something?


Have you initialized the plugins directory using InitPluginsDir or by calling a plug-in function? $PLUGINSDIR is empty until you use InitPluginsDir or a plug-in function.


InitPluginsDir
Yes I've got "InitPluginsDir" right before I extract the files to $PLUGINSDIR. I've also tried extracting the file to the current users temp directory. I'm reading the files that I'm packaging for the installer off of a network drive. I was wondering if that might be causing problems but I can't see how.


That should make no difference.

Are you using the latest development version (get the CVS files using NSIS Update)?


Just got the latest version. No difference. The one thing I have noticed is that when I run my installer on the machine that I build the installer on most of the time the ReleaseNotes.txt file will be displayed.

When I go to run it on another machine most of the time it is not displayed although there is the rare occasion where it is displayed.


Can you please attach the script? If you can't, can you please make a smaller example script?


Here's the script. I did cut alot of stuff out because it is quote large so if a function, variable constant definition is missing please ignore that.

I've included the function's I use where ReleaseNotes.txt is inovlved. I unpack the file to the pluginsdir in .onInit and use it in the FinshPage custom page function. Anything you guys might be able to suggest would be greatly appreciated.


The header bitmap and the Welcome/Finish page is also files the Modern UI extracts to the plugins directory.

Maybe they do exist but the other code is the problem.

Replace

Exec "notepad.exe $PLUGINSDIR\ReleaseNotes.txt"

by

ExecShell "open" "$PLUGINSDIR\ReleaseNotes.txt"

Maybe that helps.


Using ExecShell didn't seem to make a difference. I'm pretty sure there is something wrong elsewhere though. If I check the acutal contents of the plugins directory the release notes file is there but for some reason when I try to open it from the installer it says it can't find it.


If the header bitmap etc. work fine, there is nothing wrong with the Plugins directory.

Please check the contents of the plugins directory after launching the installer.


The pluginsdir directory looks alright. The bitmap that I use on my final custom dialog is there and so is the release notes file I want to view but any attemps to view it using notepad/wordpad fail. I'll get a message saying the file cannot be found and yet if I attempt to load the file from a command prompt window say as,

"wordpad <plugins directory>\ReleaseNotes.txt" it works. Very odd.


So even ExecShell "open" "$PLUGINSDIR\ReleaseNotes.txt" does not work?


Correction, it does work but it depends on where I make the "Execshell" call.

If I call "Execshell" to open the release notes file prior to the "FinshPage" function for my custom dialog it is displayed. If I make the "Execshell" call after the following two lines in my "FinishPage" function

!insertmacro MUI_HEADER_TEXT "Installation complete Page"
"Please Select items you wish to run
after installation is complete"

!insertmacro MUI_INSTALLOPTIONS_DISPLAY "FinishDialog.ini"

it doesn't work. As if access to the relase notes file is restricted after this final dialog is displayed. If I make the call to "Execshell" before these two lines it does work.

On a hunch I tried switching the "FinishDialog" so it appears as my second last dialog in the installer. This works as well. I can access my release notes file everytime by running "ExecShell".

There appears to be some problem after the installer displays my last dialog. At this point the plugins directory doesn't seem to be accessible. At what point does the plugins directory get deleted? Is it after .onInstSuccess?


It is deleted after .onInstSuccess.
At least that's how it appears in the source code.
Question- why are you putting your release notes in the plugins directory instead of in the installation directory. Isn't the latter the logical location?
It's possible that its a timing issue, i.e., the time it takes for the installer to exit is faster than the time it takes for notepad to pop up with the text file.
Try putting in a sleep for a couple of seconds and see what that does.


So you are calling it when your installers quits? In that case, I think the installer is faster than the text editor :)


You are right iceman_k, $PLUGINSDIR is deleted when the installer exits, and like Joost said the installer is faster than your text editor. Sleep won't help much here, you can never know how long it'll take the text editor to start up. The best way would be copying the file to a place where it won't get deleted.


I think the Release Notes are also useful for the user at a later time. So why not put 'em in your installation folder?


Thanks for the the suggestions everyone.

I did extract the file to a different location so there wouldn't be any trouble with it getting deleted from the plugins directory.