joe131
2nd June 2008 02:43 UTC
File, SetOutPath question..
Hi All,
I'm trying to write an install that will just "update"
certain files, and I'm really confused.
I've tried to look at some code examples from the web,
Google Code Search,
that use SetOutPath and File, but when I try what looks
like should work, I keep getting errors for File.
For my "Source files" I want to get individual files from different directories.
Like:
C:\Foo\bar\bin\xxx.exe
C:\Foo\bar\bin\yyy.dll
C:\Foo\Webserver\lib\xyz.jar
And since the user can choose a different install
directory path, than my original source directory,
exactly how should I extract the files into the
user's directory?
(from Foo\ back it will be the same)
They will probably have something like:
C:\Program Files\XYZ Corp\Foo\bar\bin
C:\Program Files\XYZ Corp\Foo\Webserver\lib
I tried to use "File /oname=..." but I keep getting errors..
What's the best way to do it?
I'd rather not try to use anything with "File /r".
Thanks!
LoRd_MuldeR
2nd June 2008 02:48 UTC
; set the output directory first
SetOutPath "C:\Program Files\XYZ Corp\Foo\bar\bin"
; now let's extract some files to that directory
File "C:\Foo\bar\bin\xxx.exe"
File "C:\Foo\bar\bin\yyy.dll"
File "C:\Foo\Webserver\lib\xyz.jar"
This will include the named files in your installer. The paths after the "File" commands are the paths on your local computer, evaluated at the moment the installer is compiled! Those files will be extracted to the "C:\Program Files\XYZ Corp\Foo\bar\bin" folder on the user's computer. The path after the "SetOutPath" will be evaluated at the moment the user runs the installer.
But usually you should do it like this:
SetOutPath "$PROGRAMFILES\XYZ Corp\Foo\bar\bin"
Not every user has a "C:\Program Files" folder! For example on German Windows it will be "C:\Programme". And you even can't know on which drive Windows is installed. Using the "$PROGRAMFILES" variable will detect the location of the user's "Program Files" folder at the moment the installer is run...
joe131
2nd June 2008 03:02 UTC
I already have that to "load" my source files into
the installer.
I have this, to extract it, and it keeps giving me errors:
SetOutPath "${InstallDir}\Webserver\bin"
File "/oname=${InstallDir}\Webserver\bin\xyz.dll xyz.dll
and I tried adding the same "path" to the file on the "end"
and I still get errors.
What's the proper way to do it?
Thanks!
Red Wine
2nd June 2008 04:20 UTC
See compiler's log, should claim about ${InstallDir} which probably you should change to $INSTDIR.
joe131
2nd June 2008 08:09 UTC
Sorry, this is driving me nuts!
The files are loaded into the installer:
(from the compile)
Section: "-"
SetOutPath: "$INSTDIR"
File: "WMISrv.dll" 98304 bytes
File: "ADSrv.dll" 217088 bytes
SectionEnd
I have the users install path in $Install_Directory
and I'm trying:
SetOutPath "$Install_Directory\Webserver\bin"
File ...
I've tried several things for "File" and the
compiler keeps complaining:
SetOutPath: "$Install_Directory\Webserver\bin"
File: "ADSrv.dll" -> no files found.
What the heck do I need to do to extract the file
into the user's directory???
I even tried:
SetOutPath "$INSTDIR\Webserver\bin"
and I keep getting the same error..
Red Wine
2nd June 2008 08:34 UTC
SetOutPath is a run-time instruction which changes the current working directory when installer runs.
File is a compile-time instruction which tells the compiler to compress the file e.g. local_path\my_file.ext, hence when you type File ADSrv.dll the file must be located whithin the same directory where the compiling script is located. Otherwise you must give the path to the file on the local machine.