cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
weelyn
Level 5

how does getResource work?

Hi all,
I'm trying to use the "DO NOT INSTALL" magic folder with the InstallerProxy.getResource() method (because I would like to have a better control about where, when and how I install some files).

Apparently, if I understand the documentation correctly, one should be able to put a file into "DO NOT INSTALL", and then access this file from the Java code. Putting the files into the setup is easy. Using "unzip -l" I can see them in the resulting setup (yay!).
However, they are in a deep sub-directory with a randomized name, for instance:

$IA_MERGE_RESOURCES$/Product_1327647358881/f8e40d249b11ebe81a56ecfa41ec4dac/vmware-vix.zip

I tried to access the resource with getResource("vmware-vix.zip") but (unsurprisingly) it doesn't work. I tried to look in the generated XML file in the setup, but I don't see how one can find the files in "DO NOT INSTALL".

Note that there is a way of adding files which works: adding resources to a Custom Code. In this case, the behavior seems different, I get two files:

bonjour.zip
$IA_MERGE_RESOURCES$/Product_1327647358881/db9b4d111235de28527913ea8c1d1ae7/PROD.home.bjr.zip.ccm

The "ccm" file is very small, it just contains the string "bonjour.zip".
What happens is I attached the "PROD.home.bjr.zip" as a resource for the "Execute Custom Code" action. This zip contains another zip, "bonjour.zip". InstallAnywhere puts this "bonjour.zip" directly at the top of the setup, without any intermediate directory, so when you call "getResource("bonjour.zip")" it works. (That's probably the way I'm going to go if I can't make it work using "DO NOT INSTALL".)

Finally, here's an extract of the InstallAnywhere doc about getResource:

getResource

public URL getResource(String archivePath)

This method provides a mechanism to access resources located in the installer or user archive. Resources placed in the installer should be put into the DO NOT INSTALL magic folder.

Specified by:
getResource in interface IAProxy
Specified by:
getResource in interface ResourceAccess

Parameters:
archivePath - a forward-slash ('/') delimited path relative to the root of the archive. For example "com/acme/picture.gif". If the resource is put into the installer then the path is the absolute path. For example "C:\foo\bar\picture.gif". If the path contains a source path variable then that should also by put into the archive path (ie. "$IA_PROJECT_DIR$\foo\bar\test.txt")
Returns:
an instance of java.net.URL that refers to a resource located in the installer archive.


Thanks in advance for any idea or suggestion 🙂
Labels (1)
0 Kudos
(1) Reply
nosrednayduj
Level 7

Did you try installing your file to TEMP? That's what we do.
0 Kudos