Skip to content

Commit

Permalink
Replace redundant StringBuilder usage with String#join
Browse files Browse the repository at this point in the history
  • Loading branch information
MeGysssTaa committed Jun 20, 2020
1 parent a43ba64 commit a17e375
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/main/java/me/darksidecode/keiko/tools/InspectCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,10 @@ protected void execute(String[] args) throws Exception {
StaticAnalysisManager manager = new StaticAnalysisManager();

if (args.length > 0) { // inspect one particular plugin
// Use StringBuilder to allow spaces in file/directory names.
StringBuilder pathBuilder = new StringBuilder();

for (String arg : args)
pathBuilder.append(arg).append(' ');

pathBuilder.deleteCharAt(pathBuilder.length() - 1); // delete trailing space
String path = pathBuilder.toString();

// Use String#join to allow spaces in file/directory names.
String path = String.join(" ", args);
File targetJarFile = path.contains("plugins/")
? new File(pathBuilder.toString())
? new File(path)
: new File(KeikoPluginInspector.getPluginsFolder(), path);

if (targetJarFile.isFile()) {
Expand Down

0 comments on commit a17e375

Please sign in to comment.