forked from JetBrains/intellij-community
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[platform] extracts the enumeration of external update managers into …
…a separate class
- Loading branch information
1 parent
3f72367
commit 852a90f
Showing
9 changed files
with
66 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...orm/platform-impl/src/com/intellij/openapi/updateSettings/impl/ExternalUpdateManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
package com.intellij.openapi.updateSettings.impl; | ||
|
||
import com.intellij.openapi.application.PathManager; | ||
import com.intellij.openapi.util.SystemInfo; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* Represents a tool which manages IDE updates instead of a built-in update engine. | ||
*/ | ||
public enum ExternalUpdateManager { | ||
TOOLBOX("Toolbox"), | ||
SNAP("Snap"), | ||
UNKNOWN(System.getProperty("ide.no.platform.update")); | ||
|
||
public final String toolName; | ||
|
||
ExternalUpdateManager(String name) { | ||
toolName = "true".equalsIgnoreCase(name) ? "(unknown)" : name; | ||
} | ||
|
||
/** | ||
* Returns a tool managing this IDE instance, or {@code null} when no such tool is detected. | ||
*/ | ||
public static final @Nullable ExternalUpdateManager ACTUAL; | ||
static { | ||
String home = PathManager.getHomePath().replace('\\', '/'); | ||
if (home.contains("/apps/") && home.contains("/ch-")) ACTUAL = TOOLBOX; | ||
else if (SystemInfo.isLinux && (home.startsWith("/snap/") || home.startsWith("/var/lib/snapd/snap/"))) ACTUAL = SNAP; | ||
else if (System.getProperty("ide.no.platform.update") != null) ACTUAL = UNKNOWN; | ||
else ACTUAL = null; | ||
} | ||
|
||
/** | ||
* Returns {@code true} when updates are managed by a tool which install different builds in different directories. | ||
*/ | ||
public static boolean isRoaming() { | ||
return ACTUAL == TOOLBOX || ACTUAL == SNAP; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters