Skip to content

Commit ad37f0c

Browse files
committed
Added SafeLoadFromPath
1 parent 67ac7be commit ad37f0c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

properties.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ func (m Map) parseLine(line string) error {
156156
return nil
157157
}
158158

159+
// SafeLoadFromPath is like LoadFromPath, except that it returns an empty Map if
160+
// the specified file doesn't exists
161+
func SafeLoadFromPath(path *paths.Path) (Map, error) {
162+
return SafeLoad(path.String())
163+
}
164+
159165
// SafeLoad is like Load, except that it returns an empty Map if the specified
160166
// file doesn't exists
161167
func SafeLoad(filepath string) (Map, error) {

0 commit comments

Comments
 (0)