Archive: Verify that instdir is not on a CDROM drive?


Verify that instdir is not on a CDROM drive?
Hello!!

I just want to know how can I verify (on the function .onVerifyInstdir) that the installation path is not on a CDROM drive?? is there any solution to know that??

:) :( :D ;) :p :cool: :mad: :eek: :confused: :o :hang: :cry: :igor: :blah:


Use the System plugin to invoke the Windows API function GetDriveType. I'll post back here with the exact NSIS command if I can work it out for you.

[edit]Fortunately system.nsh (in contrib\system) already defines sysGetDriveType. This script should help you:-

OutFile "blah.exe"

!include "${NSISDIR}\Contrib\System\System.nsh"

Section -
StrCpy $1 "c:\"
System::Call '${sysGetDriveType}(r1) .r0'
DetailPrint "Boo: $1 $0"
IntCmp $0 5 0 notcddrive
MessageBox MB_OK "Drive $1 is a cd drive"
notcddrive:
SectionEnd


FYI 5 is the drive type code of a cd drive as far as I can tell, well it works on my system anyway[/edit]

ok
Thank you for your help!
It seems to work fine, but i don't remember and i don't arrive to find how to catch the "c:\" when you have a full path like "c:\progam files\my app". I know that there is a function (or a pluggin) to do it, but I can't find it!!!
Perhaps somebody can help me???


you could just use strcpy $0 "C:\program files\my app" 3 which will grab the first three characters


ok thank you very much
I think i'am very tired not to find so basic things!!!
so tank you to complete my damaged mind!!!(lOl)