Skip to content

Commit

Permalink
Refine AppNameUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
CarpenterLee committed Jul 31, 2018
1 parent f1b52a6 commit bc620d6
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public final class AppNameUtil {

public static final String APP_NAME = "project.name";
public static final String SUN_JAVA_COMMAND = "sun.java.command";
private static final String JAR_SUFFIX_LOWER = ".jar";
private static final String JAR_SUFFIX_UPPER = ".JAR";

private static String appName;

Expand Down Expand Up @@ -76,7 +78,7 @@ public static void resolveAppName() {
String[] strs = command.split(File.separator);
command = strs[strs.length - 1];
}
if (command.endsWith(".jar") || command.endsWith(".JAR")) {
if (command.endsWith(JAR_SUFFIX_LOWER) || command.endsWith(JAR_SUFFIX_UPPER)) {
command = command.substring(0, command.length() - 4);
}
appName = command;
Expand Down

0 comments on commit bc620d6

Please sign in to comment.