[izpack-users] Variable substitution in install.xml
Bartz, Klaus
Klaus.Bartz at coi.de
Wed Jul 5 12:13:46 CEST 2006
Hi Gereon,
resources cannot have a path; means you can only give a name for a resource, not
a path.
You can handle the locale self or use the IzPack internal feature with the given syntax.
Resources have then the name:
something.<type>_<ISO3>
e.g
Sysman.htm_deu
This is the resource key; it have not to be the file name in your source tree; e.g.
my custom actions language file:
<res id="CustomActionsLang.xml_deu" src="subpath/CustomActionsLang_deu.xml"/>
I do this because my editor uses syntax highlithing dependent on the file extension.
May be you can use
<res id="Sysman.xml_deu" src="nls/gm/Sysman.htm"/>
<res id="Sysman.xml_eng" src="nls/gb/Sysman.htm"/>
...
No how to get the InputStream:
public class egal
{
private static final String PREFIX = "Sysman.htm";
...
public void beforePacks(AutomatedInstallData idata, Integer npacks,
AbstractUIProgressHandler handler) throws Exception
{
String resource = PREFIX + "_" + installdata.localeISO3;
InputStream ins = ResourceManager.getInstance().getInputStream(resource));
// do something with the InputStream
}
...
}
com.izforge.izpack.event.SimpleInstallerListener uses this mimik
to load the langpack for custom actions (line 138ff).
Cheers
Klaus
PS: If you go into IzPack (if you write a custom action you are in IzPack)
think from time to time where you are with your code and config files.
Means, that IzPack has more than one state.
Compile (packaging) time, install time, uninstall time.
Sometimes it is a little bit complicated to get data from one state into an other.
E.g. if you searching for install.xml at installation you can never find it
because it is the compile (packaging) specification file; only some data will
be stored in the install.jar, but in other structures as in install.xml.
>-----Original Message-----
>From: izpack-users-admin at berlios.de
>[mailto:izpack-users-admin at berlios.de]On Behalf Of Gereon Fassbender
>Sent: Wednesday, July 05, 2006 11:43 AM
>To: izpack-users at berlios.de
>Subject: RE: [izpack-users] Variable substitution in install.xml
>
>
>Hi Klaus,
>
>thanks for your answer!
>I just tried out your suggestion of a custom action. I am able
>to get the
>required variables (ISO3_LANG and INSTALL_PATH).
>To make sure that the files (eg. lang/deu/myfile) are
>available, I will
>have to add them in the resources section?
>How can I get the InputStream of such a file?
>
>Gereon
>
>_______________________________________________
>izpack-users mailing list
>izpack-users at lists.berlios.de
>http://lists.berlios.de/mailman/listinfo/izpack-users
>
More information about the izpack-users
mailing list