Skip to content

Commit 5a47114

Browse files
committed
Fix cmdline install tool unsupported OS check
`OSUtils.GetOS()` cannot return null, so the previous check never triggered.
1 parent ea2e3e2 commit 5a47114

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/java/com/laytonsmith/tools/Interpreter.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -969,13 +969,9 @@ public boolean doBuiltin(String script) {
969969
}
970970

971971
public static void install(String commandName) {
972-
if(null == OSUtils.GetOS()) {
973-
StreamUtils.GetSystemErr().println("Cmdline MethodScript is only supported on Unix and Windows");
974-
return;
975-
}
976972
switch(OSUtils.GetOS()) {
977973
case LINUX:
978-
case MAC:
974+
case MAC: {
979975
try {
980976
URL jar = Interpreter.class.getProtectionDomain().getCodeSource().getLocation();
981977
File exe = new File(UNIX_INTERPRETER_INSTALLATION_LOCATION + commandName);
@@ -1008,7 +1004,8 @@ public static void install(String commandName) {
10081004
return;
10091005
}
10101006
break;
1011-
case WINDOWS:
1007+
}
1008+
case WINDOWS: {
10121009
Path tmp = null;
10131010
try {
10141011
// C# installer, not really uninstallable, so temporarily removing this, so the other installer
@@ -1071,6 +1068,11 @@ public static void install(String commandName) {
10711068
System.exit(1);
10721069
}
10731070
break;
1071+
}
1072+
default: {
1073+
StreamUtils.GetSystemErr().println("Cmdline MethodScript is only supported on Unix and Windows");
1074+
return;
1075+
}
10741076
}
10751077
StreamUtils.GetSystemOut().println("MethodScript has successfully been installed on your system. Note that you may need to rerun the install command"
10761078
+ " if you change locations of the jar, or rename it. Be sure to put \"#!" + UNIX_INTERPRETER_INSTALLATION_LOCATION + commandName + "\" at the top of all your scripts,"

0 commit comments

Comments
 (0)