2
A
回答
0
您可以使用ApplicationRegistry
API用於此目的。以下是一個示例代碼片段,可用於「啓動」節點中的「運行腳本」操作,以防止當前版本已安裝時的安裝:
// The value returned by context.getInstallationDirectory() will be the
// last installation directory
// if the user has already installed the application
ApplicationRegistry.ApplicationInfo applicationInfo =
ApplicationRegistry.getApplicationInfoByDir(context.getInstallationDirectory());
if (applicationInfo == null) {
// The application has never been installed before
return true;
}
// The version of this installer is contained in a system installer variable
String myVersion = (String)context.getVariable("sys.version");
if (applicationInfo.getVersion().equals(myVersion)) {
// In that case the current version is already installed.
Util.showErrorMessage("The current version is already installed in this directory");
// By returning "false", the action will fail and the installer will quit.
// Note that you have to set the "Failure strategy" property of your
// "Run script" action to "Quit on error", otherwise the installer will continue.
return false;
} else {
return true;
}
相關問題
- 1. 獲取apk版本升級包版本
- 2. 如何獲取當前的dev_appserver版本?
- 3. 如何獲取當前EF版本
- 4. 如何檢查當前版本的sympy並升級到最新版本
- 5. 如何升級symfony2版本?
- 6. 如何升級SQLite版本?
- 7. 升級升級版本
- 8. SonarQube ::當前版本太舊。請首先升級到長期支持版本
- 9. 在Subclipse中獲取當前版本號?
- 10. 獲取當前客戶端Silverlight版本?
- 11. 獲取當前的Flash版本(jQuery等)
- 12. 如何獲取模板中當前URL的本地化版本?
- 13. 提升:從機器獲取與當前時區當前LOCAL_DATE_TIME
- 14. 如何升級Heroku Leiningen版本?
- 15. 如何升級codeigniter框架的版本?
- 16. 如何升級心理版本> = 2.0
- 17. 如何升級我的libyaml版本
- 18. 如何在quicklisp中升級asdf版本?
- 19. 如何將phpunit升級到新版本?
- 20. 如何升級Windows的Subversion版本Netbeans
- 21. 如何升級Apache Spark版本
- 22. 如何升級leiningen的nrepl版本?
- 23. 如何自動升級WampServer版本?
- 24. 如何升級odoo中的python版本
- 25. 如何升級nodejs到最新版本
- 26. 當服務主要升級失敗時安裝以前的版本
- 27. 有沒有辦法強制install4j auto updater更新當前版本?
- 28. 升級rails版本時出現問題
- 29. 當休眠版本升級到4.2.0時,Hibernate.INTEGER不可用.CR1
- 30. Elasticsearch - 從版本5.0升級。到5.2 - 由apt升級引起的版本降級