From 937931d53d3dabf56580dc3f1ce013f487348281 Mon Sep 17 00:00:00 2001 From: Mark Kittisopikul Date: Wed, 17 Jul 2024 19:00:55 -0400 Subject: [PATCH] Fix Base.parent by splitting on / only, fix #1161 --- src/groups.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/groups.jl b/src/groups.jl index 750a44ea7..1f692f1eb 100644 --- a/src/groups.jl +++ b/src/groups.jl @@ -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