-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #441 from jfdenise/bootable_jar_with_galleon_api_v2
Add support for bootable JAR
- Loading branch information
Showing
31 changed files
with
3,551 additions
and
18 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 |
---|---|---|
|
@@ -6,17 +6,42 @@ | |
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
/** | ||
* | ||
* @author [email protected] | ||
*/ | ||
public class Utils { | ||
private static final Pattern WHITESPACE_IF_NOT_QUOTED = Pattern.compile("(\\S+\"[^\"]+\")|\\S+"); | ||
|
||
public static boolean isValidHomeDirectory(final Path path) { | ||
return path != null | ||
&& Files.exists(path) | ||
&& Files.isDirectory(path) | ||
&& Files.exists(path.resolve("jboss-modules.jar")); | ||
} | ||
|
||
/** | ||
* Splits the arguments into a list. The arguments are split based on | ||
* whitespace while ignoring whitespace that is within quotes. | ||
* | ||
* @param arguments the arguments to split | ||
* | ||
* @return the list of the arguments | ||
*/ | ||
public static List<String> splitArguments(final CharSequence arguments) { | ||
final List<String> args = new ArrayList<>(); | ||
final Matcher m = WHITESPACE_IF_NOT_QUOTED.matcher(arguments); | ||
while (m.find()) { | ||
final String value = m.group(); | ||
if (!value.isEmpty()) { | ||
args.add(value); | ||
} | ||
} | ||
return args; | ||
} | ||
} |
Oops, something went wrong.