Skip to content

Commit

Permalink
Fix Base.parent by splitting on / only, fix #1161
Browse files Browse the repository at this point in the history
  • Loading branch information
mkitti committed Jul 17, 2024
1 parent fb52906 commit 937931d
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 937931d

Please sign in to comment.