Skip to content

Commit

Permalink
Add support from reading from jimfs in-memory FS (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
clintval authored Dec 25, 2023
1 parent 5b6c71d commit 0c5642e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ public List<String> read() throws DotenvException, IOException {

String location = dir + "/" + filename;
String lowerLocation = location.toLowerCase();
Path path = lowerLocation.startsWith("file:") || lowerLocation.startsWith("android.resource:")
? Paths.get(URI.create(location))
: Paths.get(location);
Path path = (
lowerLocation.startsWith("file:")
|| lowerLocation.startsWith("android.resource:")
|| lowerLocation.startsWith("jimfs:")
) ? Paths.get(URI.create(location)) : Paths.get(location);

if (Files.exists(path)) {
return Files.readAllLines(path);
Expand Down

0 comments on commit 0c5642e

Please sign in to comment.