Page 1 of 2

Install File 'As'

Posted: Tue Jul 14, 2009 4:56 am
by asparagusx
Apologies if this is a stupid question! I would like to install a file, but 'rename' it in the process. I have a source file called 'splash.jpg' and would like to install to a sub folder of $TARGETDIR$ and also rename it at the same stage to then contents of a variable or 'hardwire' it to another name.

This is my 'required' line of MSICode :

Code: Select all

Install File ....\\splash.jpg to $TARGETDIR$\\SYSTEM\\DX.JPG


What the system is doing is to create a folder called DX.JPG and it then places splash.jpg into that sub folder - which is incorrect. I would like to place splash.jpg as DX.jpg in $TARGETDIR$\\SYSTEM.

Any ideas?

Anton

Posted: Tue Jul 14, 2009 6:23 am
by ALive
Good question!
I've also encountered with this issue. For now I'm renaming the file during the build process (witch is not the best way, because we have a duplicated files) and then build the installer.

"Install Files As" would be a great feature!!!

Posted: Tue Jul 14, 2009 7:57 am
by MichaelNesmith
This is currently not supported. I have added it to our wish list. I like the command name Install File As :)

Do you have any suggestions on implementing this command? Should it support single files only, or multiple files, etc.?

Posted: Tue Jul 14, 2009 8:21 am
by DanStutzman
Definately multiple files. This would be nice for folders as well.

Posted: Tue Jul 14, 2009 8:44 am
by MichaelNesmith
So how would you do an Install Files As over multiple files?

Posted: Tue Jul 14, 2009 9:42 am
by DanStutzman
I would do simply do it as you would do for a single, just adding multiple lines to the GUI. To make it any more complex would be a debugging nightmare.

InstallFile(s)As

Source:
[TEXTBOX]
Destination:
[TEXTBOX]

Etc.

I would also add InstallFolderAS but because of ICE Validation it would have to be a one to one value.

Also, to conform with ICE validation, the InstallFile(s)As function would have to follow the following rules:

1. The files have to go to the same location.
2. Have to be part of the same component.
3. They have to be part of the same component GUID.
4. The function cannot change file extensions as this would also violate ICE validation.
5. This function would have to be disabled for all registered file types.


Actually when thinking about it, lets set multiple file on the back burner and just focus on keeping within Windows Installer rules for a single file and/or folder.

This is just off the top of my head with the new zero-day threats that just came out from MS.

Posted: Tue Jul 14, 2009 11:35 am
by asparagusx
I think it is also very important that variables could be used in the destination.

Posted: Tue Jul 14, 2009 1:45 pm
by DanStutzman
asparagusx wrote:I think it is also very important that variables could be used in the destination.


That is a given. Variable handling is consistent no matter what the function.

Posted: Tue Jul 14, 2009 3:05 pm
by MichaelNesmith
Thanks for the feedback, but my question was more related to how to represent/state a multiple-file rename operation with just two input fields (source files and target folder).

Posted: Tue Jul 14, 2009 3:30 pm
by DanStutzman
MichaelNesmith wrote:Thanks for the feedback, but my question was more related to how to represent/state a multiple-file rename operation with just two input fields (source files and target folder).


If you are limited to two input fields, that means that you are basically creating a string and that is gonna get dirty really quickly and so I wouldn't. Actually, in accordance with ICE, I would not support multiple file renames, even though I recommended it.

I would do a simple 1 to 1 file rename function with the existing functions.

Posted: Tue Jul 14, 2009 3:51 pm
by MichaelNesmith
Doesn't that severely restrict the usability of this new command though? Any other opinions?

Posted: Wed Jul 15, 2009 1:17 am
by ALive
Agree with Dan. Making this command for a bunch of files simultaneously will be hard to implement. IMO, just two fields wont give much options for multiple file renaming. Maybe it should be just "Install File As" (without "s").
Again, IMO, the situation when you need to rename file during setup is not often.

Have a nice day!

Posted: Wed Jul 15, 2009 6:07 am
by MichaelNesmith
Leaving the ICE issues aside (InstallAware always takes care of the icing on the cake automatically ;)), would you suggest any additional or different input fields - to facilitate multiple file renames in an intuitive and sensible way?

Posted: Mon Jul 27, 2009 3:30 pm
by Chris Miller
DanStutzman wrote:Definately multiple files. This would be nice for folders as well.

I'm curious, what would be the use case for multiple files? I can't picture the UI for the action being easy to work with. It would be easier to copy or rename the files before you build the installer.

Posted: Mon Jul 27, 2009 3:46 pm
by MichaelNesmith
The same could be said of the single file scenario, could it not?