- NSIS Discussion
- CD vs. harddisk
Archive: CD vs. harddisk
zoli
24th April 2003 18:09 UTC
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
Yathosho
24th April 2003 19:01 UTC
you didnt attach anything.
Joost Verburg
24th April 2003 19:34 UTC
Doens't the installer start at all or is it ExecShell causing the problem?
zoli
25th April 2003 09:29 UTC
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>
R@m00n
25th April 2003 10:21 UTC
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.
Afrow UK
25th April 2003 10:50 UTC
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
kichik
25th April 2003 15:01 UTC
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?
zoli
27th April 2003 10:54 UTC
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
virtlink
27th April 2003 14:27 UTC
So you mean that $EXEDIR becomes the following:
C
D
E:\Whatever
right?
Is this a bug in NSIS, in Windows or what?
kichik
27th April 2003 17:25 UTC
It's an old bug in NSIS. What version are you using?
zoli
28th April 2003 08:44 UTC
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
Joost Verburg
28th April 2003 11:25 UTC
NSIS 2 beta 1 is an old version. Upgrading is recommended.
virtlink
30th April 2003 16:35 UTC
So is this 'bug' eliminated in the latest versions (or releases)?
kichik
30th April 2003 16:36 UTC
Yes, it's an old bug.