PDA

View Full Version : Install a file with diff names



Larry Teames
05-31-2007, 11:00 AM
I have the following need, but see no straight forward way to install a file with a name other than it's original (source) name:

IF <condition met>
install XXXX.EXE as XXXX.EXE
ELSE
install XXXX.EXE as XXXX.EXX
END

How is this best handled?

linder
06-01-2007, 04:47 AM
Hi Larry,

You can't. One option is to rename the file after the installation process.

IF <condition met>
install XXXX.EXE as XXXX.EXE
rename XXXX.EXE to XXXX.EXE
ELSE
install XXXX.EXE as XXXX.EXX
rename XXXX.EXE to XXXX.EXE
END

Please note this will not automatically rename the file in the uninstall. So you have to handle this in a custom uninstall script.

Friedrich

Larry Teames
06-01-2007, 10:13 AM
Okay, thanks. The renaming is what I had come up with, but I was hoping for a less problematic solution (like I had overlooked some option that allows me to install under a different name <G>).

linder
06-01-2007, 10:33 AM
<G> I'll see if it is possible to implement this. The underlying compression library already supports this (it automatically kicks in when patch files are processed) but it's not directly accessible through the script. I'll see what we can do...

Friedrich

CMS Software
07-11-2008, 11:06 AM
Friedrich,

If you are still thinking of implimenting this feature, here is a suggestion.

In the INNO installer that I abandoned for SB6, you could do the following:

Install "FileName.exe" as OtherName.exe"

You could even do:

Install "FileName.TXT" as "OtherName.DAT"

The "AS" option was just one of the "Install Function" parameters along with "OnlyIfDoesntExist" and "Always Replace", ETC.

This makes installation file renaming an inline procedure and not a "6 line routine" procedure.

The real upside of this is that the new file name was automatically recognized by the uninstaller because the OtherName.xxx file name was placed in the uninstaller log file rather than the source file name.

We used this function to keep multiple versions of our main app online at all times, each with its own name, but always installed with the same name.

Example:
Source files named:
App5Sgl.exe is version 5 Single User.
App5Net5.exe is version 5 Network 5 user.
App5NetX.exe is version 5 Network 10 user.

The installer would pick up the correct SOURCE file based on a compiler variable and then install it on the user's system as APP5.exe. Multiple different source file names, one destination file name.

Originally we had just kept the different versions in different folders, all with the name APP5.EXE. This gave problems when someone copied the wrong version into a folder (since the versions all had the same name). With the new method we know which version each EXE file contains by its name and the installer takes care of renaming the EXE file to the correct destination name. This solved many major headaches for us.

Hope this helps.

-O. D.-

CMS Software
07-17-2008, 03:15 PM
There is another way to achieve this. Let's say you have several exe files with names like this:

App5SglUser.exe <- This is the single user version.
App5Net5.exe <- This is the Network 5 user version.
App5Net10.exe <- This is the Network 10 user version.

However, the installed program should be just named APP5.EXE regardless of which version the user has purchased.

You can use the "Releases" function to achieve the following result, or you can define SB variables as follows:

!#Def EDITION_TYPE = "SglUsr"
!#Def EDITION_TYPE = "Net5Usr"
# Def EDITION_TYPE = "Net10Usr"

Notice that the first two definitions are commented out, but the third one, for Network 10 User, is active.

Now, early in the SB install script we put the following tests and commands.

#Ifdef EDITION_TYPE = "SglUsr" then
#copy "C:\NEWEXES\App5SglUser.exe" to "C:\SBApp5Exes\APP5.exe"
#end

#Ifdef EDITION_TYPE = "Net5Usr" then
#copy "C:\NEWEXES\App5Net5.exe" to "C:\SBApp5Exes\APP5.exe"
#end

#Ifdef EDITION_TYPE = "Net10Usr" then
#copy "C:\NEWEXES\App5Net10.exe" to "C:\SBApp5Exes\APP5.exe"
#end

Finally, in the Install Files section we put the following command:

Install File "C:\SBApp5Exes\APP5.exe" to "%SB_InstallDir%\APP5.exe" (Always Install)

This way, several source files each with a different name are installed under the same name and the install name (App5.exe) is placed in the uninstall log. Problem solved!

Perhaps someday SB will have a "Rename" function in the install command. Until then, it is up to us to use our noggins to string together the existing commands to achieve the desired results in the best way.

I would personally prefer the above method to twiddling the UnInstaller to handle each of the source file names listed above. I do not want to mess with any of the provided SetupBuilder features, just make maximum use of them.

Hope this helps!

-O. D.-