Skip to content

Commit

Permalink
Handle file not found on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
juri committed May 12, 2024
1 parent 0ecf6c6 commit 256d1e5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/DotEnvy/Load.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ extension DotEnvironment {
data = try Data(contentsOf: url)
} catch let error as NSError where error.domain == NSCocoaErrorDomain && error.code == NSFileReadNoSuchFileError {
return [:]
} catch let error as NSError where error.domain == NSPOSIXErrorDomain && error.code == ENOENT {
return [:]
}
guard let str = String(data: data, encoding: .utf8) else {
throw LoadError.dataDecodingError(url.absoluteURL)
Expand Down

0 comments on commit 256d1e5

Please sign in to comment.