mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
updater and patch script: support patches between installers with renamed jre64 to jbr
GitOrigin-RevId: 97d8b4ab5b990c076ce2c6e6e6c7fb4f14db2443
This commit is contained in:
committed by
intellij-monorepo-bot
parent
63e164babb
commit
8b03aae4ca
+2
-1
@@ -187,7 +187,8 @@ object UpdateInstaller {
|
||||
private fun getTempDir() = File(PathManager.getTempPath(), "patch-update")
|
||||
|
||||
private fun getJdkSuffix(): String {
|
||||
val jreHome = File(PathManager.getHomePath(), if (SystemInfo.isMac) "jdk" else "jre64")
|
||||
var jreHome = File(PathManager.getHomePath(), "jbr")
|
||||
if (!jreHome.exists()) jreHome = File(PathManager.getHomePath(), if (SystemInfo.isMac) "jdk" else "jre64")
|
||||
if (!jreHome.exists()) return "-no-jbr"
|
||||
val releaseFile = File(jreHome, if (SystemInfo.isMac) "Contents/Home/release" else "release")
|
||||
val version = try {
|
||||
|
||||
@@ -363,11 +363,12 @@ public class Patch {
|
||||
}
|
||||
|
||||
File jre64 = new File(toDir.getAbsolutePath() + "/jre64");
|
||||
File jbr = new File(toDir.getAbsolutePath() + "/jbr");
|
||||
if (jbr.exists()) Runner.logger().info("jbr bundled: " + jbr.getAbsolutePath());
|
||||
if (jre64.exists()) Runner.logger().info("jre64 bundled: " + jre64.getAbsolutePath());
|
||||
for (File directory : createdDirectories) {
|
||||
File[] children = directory.listFiles();
|
||||
if (children != null &&
|
||||
(!directory.getAbsolutePath().contains("jre64") ||
|
||||
directory.getAbsolutePath().contains("jre64") && !jre64.exists()) &&
|
||||
if (children != null && pruningEmptyDir(toDir, directory, jre64, jbr) &&
|
||||
createdOptionalFiles.containsAll(Arrays.asList(children))) {
|
||||
Runner.logger().info("Pruning empty directory: " + directory);
|
||||
try {
|
||||
@@ -390,6 +391,13 @@ public class Patch {
|
||||
return new PatchFileCreator.ApplicationResult(true, appliedActions);
|
||||
}
|
||||
|
||||
private boolean pruningEmptyDir(File toDir, File directory, File jre64, File jbr) {
|
||||
return ((!directory.getAbsolutePath().contains("jre64") ||
|
||||
(directory.getAbsolutePath().contains("jre64") && !jre64.exists())) &&
|
||||
(!directory.getAbsolutePath().contains("jbr") ||
|
||||
(directory.getAbsolutePath().contains("jbr") && !jbr.exists())));
|
||||
}
|
||||
|
||||
public void revert(List<? extends PatchAction> actions, File backupDir, File rootDir, UpdaterUI ui) throws IOException {
|
||||
Runner.logger().info("Reverting... [" + actions.size() + " actions]");
|
||||
ui.startProcess("Reverting...");
|
||||
|
||||
Reference in New Issue
Block a user