-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also fixing downloads on macOS (Closes #1429) Co-authored-by: Michael Lasevich <michael.lasevich@bhnetwork.com> Co-authored-by: Alexander Schwartz <alexander.schwartz@gmx.net>
- Loading branch information
1 parent
60ee1a5
commit 79cd0d4
Showing
6 changed files
with
237 additions
and
157 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.asciidoc.intellij.arch; | ||
|
||
import java.util.Locale; | ||
|
||
public enum Arch { | ||
ARM, | ||
INTEL; | ||
|
||
static Arch identify() { | ||
String osArch = System.getProperty("os.arch").toLowerCase(Locale.ROOT); | ||
if (osArch.contains("arm") || osArch.contains("aarch64")) { | ||
return Arch.ARM; | ||
} | ||
return Arch.INTEL; | ||
} | ||
} |
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,28 @@ | ||
package org.asciidoc.intellij.arch; | ||
|
||
import com.intellij.openapi.util.SystemInfoRt; | ||
|
||
public enum OS { | ||
LINUX(SystemInfoRt.isLinux), | ||
MAC(SystemInfoRt.isMac), | ||
WINDOWS(SystemInfoRt.isWindows), | ||
OTHER(true); | ||
|
||
public final boolean active; | ||
|
||
OS(boolean active) { | ||
this.active = active; | ||
} | ||
|
||
/** | ||
* Get active OS. | ||
*/ | ||
public static OS identfy() { | ||
for (OS os : OS.values()) { | ||
if (os.active) { | ||
return os; | ||
} | ||
} | ||
return OS.OTHER; | ||
} | ||
} |
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,30 @@ | ||
package org.asciidoc.intellij.arch; | ||
|
||
public enum Platform { | ||
LINUX_ARM(OS.LINUX, Arch.ARM, "arm64"), | ||
LINUX_INTEL_64(OS.LINUX, Arch.INTEL, "amd64"), | ||
WINDOWS_INTEL_64(OS.WINDOWS, Arch.INTEL, "x86_64"), | ||
MAC_ARM64(OS.MAC, Arch.ARM, "arm64"), | ||
MAC_INTEL_64(OS.MAC, Arch.INTEL, "x86_64"), | ||
OTHER(null, null, ""); | ||
public final String archName; | ||
public final OS os; | ||
public final Arch arch; | ||
|
||
Platform(OS os, Arch arch, String archName) { | ||
this.arch = arch; | ||
this.os = os; | ||
this.archName = archName; | ||
} | ||
|
||
public static Platform identify() { | ||
OS os = OS.identfy(); | ||
Arch arch = Arch.identify(); | ||
for (Platform platform : Platform.values()) { | ||
if ((platform.os == os) && (platform.arch == arch)) { | ||
return platform; | ||
} | ||
} | ||
return Platform.OTHER; | ||
} | ||
} |
Oops, something went wrong.