Skip to content

Commit

Permalink
Fix Base.parent by splitting on / only, fix #1161 (#1162)
Browse files Browse the repository at this point in the history
* Fix Base.parent by splitting on / only, fix #1161

* Apply formatter
  • Loading branch information
mkitti authored Aug 13, 2024
1 parent f95dd04 commit fbcd95d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/groups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ function Base.parent(obj::Union{File,Group,Dataset})
if length(path) == 1
return f
end
parentname = dirname(path)
# Only split on / not \
# See "HDF5 Path Names and Navigation" under "The HDF5 Data Model and File Structure"
path_parts = split(path, "/")
parentname = join(path_parts[1:(end - 1)], "/")
if !isempty(parentname)
return open_object(f, dirname(path))
return open_object(f, parentname)
else
return root(f)
end
Expand Down

0 comments on commit fbcd95d

Please sign in to comment.