Archive: CD vs. harddisk


CD vs. harddisk
Disclaimer: I searched the site but did not find answer to my question.

Has anybody experienced differences between running the created install from burnt CD or harddisk?

I have a small installer asking the user to select between
1) running the (html) application from the CD or
2) running another installer which copies the application to the HDD and launches it from there.

My problem is that this first installer works fine from my disk before burning it to the CD, but just does not launch anything if I run it from the CD.

The related code from this first installer is the following:

Section "CD-meghajtóról futtatom" sec1
ExecShell "open" "$EXEDIR\FIGURAKATALOGUS\START.HTM"
SectionEnd

Section "Feltelepítem a gépre" sec2
Exec "$EXEDIR\INSTALL\SETUP_TANC.EXE"
SectionEnd


If I manually launch them (either the html or the setup) then they are working, reachable, etc. I've also created a version with messageboxes displaying the path before launching the files and it seemed good.


Thanks in advance.

The full file is attached as well


you didnt attach anything.


Doens't the installer start at all or is it ExecShell causing the problem?


What happens is that the first installer gets executed as far as I see, so I can select which option to launch.

After selecting and pressing the button, the first installer terminates, but the second installer (or the application) is not launched.

If I do the same from the winchester then they are launched.

<I will give another try to attach the .nsi file in the evening, it is on my home computer>


It's caused by this fault:
On HDD: $EXEDIR=C:\Test -> C:\Test\FIGURAKATALOGUS\START.HTM
On CD: $EXEDIR=D:\ -> D:\\FIGURAKATALOGUS\START.HTM

So it uses to Backslashes. You need to check if Exedir ends with a Backslash and if yes then remove it.


Use this...

Push [Your string]
Call removebs
Pop $R0

If [Your string] had a backslash on the end (\) then it will now be removed.


Function removebs
Exch $R0
Push $R1
StrCpy $R1 $R0 1 -1
StrCmp $R1 "\" 0 +2
StrCpy $R0 $R0 -1
Pop $R1
Exch $R0
FunctionEnd


-Stu

R@m00n, that's not true. $EXEDIR and friends are always stripped down from the last back-slash. Besides, he said the path looked OK to him.

I had no problem doing what you're trying to do from a CD or hard-disk. What version of NSIS and Windows are you using?


Hi Guys!

Thanks to all of you for the tips and help.

Now it is working. You were right kichik that this was not the backslash, but still, the comment of RamOOn made me reactivate my debug messageboxes and it turned out that there was indeed a mistake in the path:

On the CD root (and in the harddisk root as well) $EXEDIR evaluates to G (or C), so no backslash but there is the colon missing.

So here is my code now:

Push $EXEDIR
Call fix_exe_path
Pop $R0
Exec "$R0\INSTALL\SETUP_TANC.EXE"

the similar for the "launch the html" as well.

And the function:

Function fix_exe_path
Exch $R0
Push $R1
Push $R2
StrLen $R1 $R0
IntCmp $R1 1 0 0 +3
StrCpy $R2 ":"
StrCpy $R0 "$R0$R2"
Pop $R2
Pop $R1
Exch $R0
FunctionEnd

THANKS AGAIN.
Zoli


So you mean that $EXEDIR becomes the following:

C
D
E:\Whatever


right?

Is this a bug in NSIS, in Windows or what?

It's an old bug in NSIS. What version are you using?


You are right Virtlink.

From this experience, if you are in the root of a drive then $EXEDIR (at least in my version) evaluates only to the drive label, so C or D, etc.

When you are in a directory, then it is fine, so you get back C:\Directory_name

If I remember well then I am using the nsis20b1.exe


NSIS 2 beta 1 is an old version. Upgrading is recommended.


So is this 'bug' eliminated in the latest versions (or releases)?


Yes, it's an old bug.