差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
java:installanywhere:upgrade:previous_version_detection [2018/11/30 15:05] tony [Problem] |
— (目前版本) | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== How to detect previous version in InstallAnywhere? ====== | ||
- | ===== Problem ===== | ||
- | 軟體升級是維護產品必經之路。透過安裝程式升級,幾乎是大家都會使用的方式。 | ||
- | ===== How to? ===== | ||
- | ==== CustomCodeRule - HasPreviousVersionRule ==== | ||
- | <code java> | ||
- | package org.tonylin.practice.ia.customcode; | ||
- | |||
- | import com.zerog.ia.api.pub.CustomCodeRule; | ||
- | |||
- | public class HasPreviousVersionRule extends CustomCodeRule { | ||
- | @Override | ||
- | public boolean evaluateRule() { | ||
- | String base_version = (String)ruleProxy.getVariable("BASE_PRODUCT_VERSION"); | ||
- | if( base_version == null || base_version.isEmpty() ) { | ||
- | return false; | ||
- | } | ||
- | |||
- | String installer_version = (String)ruleProxy.getVariable("PRODUCT_VERSION_NUMBER"); | ||
- | |||
- | return installer_version.compareTo(base_version) >= 1; | ||
- | } | ||
- | } | ||
- | </code> | ||
- | |||
- | |||
- | ===== Reference ===== | ||
- | * [[https://helpnet.flexerasoftware.com/installanywhere2015/Content/helplibrary/ia_ref_actions_modifyxml.htm#reference-part2_4211107119_1375517|InstallAnywhere 2015 Help Library - Read/Modify XML File Action]] | ||
- | * [[https://helpnet.flexerasoftware.com/installanywhere2015/Content/helplibrary/ia_ref_variables_std_ia_vars.htm|InstallAnywhere 2015 Help Library - Standard InstallAnywhere Variables]] | ||
- | |||