JWTEUNISSE
30th July 2003 21:14 UTC
how to check if the disk on which to install the software exists
For a small piece of software and some data files I have to check first if the target disk (D:) exists. If not, then install the software on the c: disk.
Is there any way to perform this?
I have tried ifileexist, but I get compile errors.
Searching the discussion I couldnot find a solution.
Please help?
Thanks.
Joel
30th July 2003 21:27 UTC
Does the software wrote registry keys or
have a pre-defined installation path?
Afrow UK
31st July 2003 11:28 UTC
Firstly you can check if the D or C drives exist first like so:
IfFileExists "D:\" +2
MessageBox MB_OK "D: drive does not exist" ID_OK done1
## place search !insertmacro here ##
done1:
IfFileExists "C:\" +2
MessageBox MB_OK "C: drive does not exist" ID_OK done2
## place search !insertmacro here ##
done2:
The search function is here:
http://nsis.sourceforge.net/archive/...ances=0,11,211
-Stu
JWTEUNISSE
31st July 2003 15:44 UTC
Thanks for your reply.
First the software does not write registry keys. The goal is to do a silent install. When for the first time we do an install the installer checks 1) for the D: disk and if not present uses the C: disk.
The second or the next time an update of the usersoftware is needed, we do the same check. The installation directories have always the same name and structure.
Does this help to use the proposed solution.?
regards, jan willem
Afrow UK
31st July 2003 16:13 UTC
Use my example.
It may need modifying.
I would modify it for you but my thinking head is still asleep at the moment :(
-Stu
JWTEUNISSE
31st July 2003 21:33 UTC
Stu, I would be much obliged, if you could modify it.
Thanks in advance
jan willem
Afrow UK
31st July 2003 21:44 UTC
Ok, I have my mind in gear a bit more now lol
No need for search functio nat all.
IfFileExists "D:\" 0 install_on_c
DetailPrint "Installing software to D: drive"
## place files here ##
Goto done
install_on_c:
DetailPrint "Installing software to C: drive"
## place files here ##
done:
-Stu
JWTEUNISSE
1st August 2003 10:56 UTC
Many thanks Stu,
With a small modification, this works OK.
The IfFileExists needs a *.* to check for the D: disk.
code:--------------------------------------------------------------------------------
IfFileExists "D:\*.*" 0 install_on_c
DetailPrint "Installing software to D: drive"
## place files here ##
Goto done
install_on_c:
DetailPrint "Installing software to C: drive"
## place files here ##
done:
--------------------------------------------------------------------------------