Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public Path file() {
try {
return Paths.get(uri);
} catch (FileSystemNotFoundException e) {
URI rootFs = URI.create(StringUtil.takeUntil(uri.toString(), "\\!"));
String internal = StringUtil.takeAfter(uri.toString(), "\\!");
try (FileSystem zipfs = FileSystems.newFileSystem(rootFs, new HashMap<>())) {
return zipfs.getPath(internal);
}
URI rootFs = URI.create(StringUtil.takeUntil(uri.toString(), "!"));
String internal = StringUtil.takeAfter(uri.toString(), "!");
// keep the file system open.
FileSystem zipfs = FileSystems.newFileSystem(rootFs, new HashMap<>());
return zipfs.getPath(internal);
}
} catch (URISyntaxException | IOException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,14 +504,14 @@ public static String move(@NonNull String text, int line, int charPositionInLine

/// Returns the string until the first match of the given regex.
public static String takeUntil(String content, String regex) {
var array = content.split(regex, 1);
var array = content.split(regex, 2);
return array[0];
}

/// Returns the string after the first match of the given regex.
public static String takeAfter(String content, String regex) {
var array = content.split(regex, 1);
return array[0];
var array = content.split(regex, 2);
return array[1];
}


Expand Down
Loading