Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apply minor enebo's comments #1809

Merged
merged 1 commit into from Jul 16, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -17,7 +17,6 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import java.util.regex.Pattern;

class LibrarySearcher {
static class Ruby18 extends LibrarySearcher {
Expand Down Expand Up @@ -50,8 +49,6 @@ public String getScriptName() {
}
}

private static final Pattern ABSOLUTE_PATH_PATTERN = Pattern.compile("([^:]+:)*/.*");

private final LoadService loadService;
private final Ruby runtime;
private final Map<String, Library> builtinLibraries;
Expand All @@ -74,8 +71,7 @@ public FoundLibrary findBySearchState(LoadService.SearchState state) {

public FoundLibrary findLibrary(String baseName, SuffixType suffixType) {
for (String suffix : suffixType.getSuffixes()) {
FoundLibrary library = null;
if (library == null) library = findBuiltinLibrary(baseName, suffix);
FoundLibrary library = findBuiltinLibrary(baseName, suffix);
if (library == null) library = findResourceLibrary(baseName, suffix);
if (library == null) library = findServiceLibrary(baseName, suffix);

Expand Down Expand Up @@ -134,7 +130,7 @@ private FoundLibrary findResourceLibrary(String baseName, String suffix) {
}

// If path is absolute, try loading it directly
if (ABSOLUTE_PATH_PATTERN.matcher(baseName).matches()) {
if (new File(baseName).isAbsolute()) {
return findFileResource(baseName, suffix);
}

Expand Down