path exists

Hello,

I'm a little bit confused, because I run into sematic errors to check of a path / object exists in a HDF file.

I'm using at the moment within a CXX class the call H5Lexists( m_file.getId(), mypath.c_str() ), but in the documentation I
have found ( http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Exists ) that I must iterate over all pathes.
I have found also the http://www.hdfgroup.org/HDF5/doc/HL/RM_H5LT.html#H5LTpath_valid path_validate call
but I can not create a working example.
I'm using the 1.8.9 version of the library.

I would like to check if a absolut path exists in the file / point to an existing object. My path shows something like
/mygroup1/mygroup2/dataset1 so the call should be return true if exist, and false if not. I don't use relative pathnames
IMHO I have used the H5Lexists(m_file.getId(), "/mygroup1/mygroup2/dataset1") call but it returns also true, if the path
does not exists.
I would like check, that the full path (all items) exists, only all items exsist, I want return true-

Which is the correct way to do this?

Thanks

phil

H5LTpath_valid will tell you if the path exists. For your case it would be:

htri_t path_valid = H5LTpath_valid(file_id,"/mygroup1/mygroup2/dataset1",FALSE)

(side note: Are you saying the above path does actually not exists and therefore should return FALSE?)

This would check if all the links exists. What error are you having in your working example when using H5LTpath_valid? Different test cases can be found in hl/test/test_lite.c in the source if you need to look at some example use cases.

ยทยทยท

On 2012-07-08 07:02, Philipp Kraus wrote:

Hello,

I'm a little bit confused, because I run into sematic errors to check
of a path / object exists in a HDF file.

I'm using at the moment within a CXX class the call H5Lexists(
m_file.getId(), mypath.c_str() ), but in the documentation I
have found (
http://www.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-Exists ) that I
must iterate over all pathes.
I have found also the
http://www.hdfgroup.org/HDF5/doc/HL/RM_H5LT.html#H5LTpath_valid
path_validate call
but I can not create a working example.
I'm using the 1.8.9 version of the library.

I would like to check if a absolut path exists in the file / point to
an existing object. My path shows something like
/mygroup1/mygroup2/dataset1 so the call should be return true if
exist, and false if not. I don't use relative pathnames
IMHO I have used the H5Lexists(m_file.getId(),
"/mygroup1/mygroup2/dataset1") call but it returns also true, if the
path
does not exists.
I would like check, that the full path (all items) exists, only all
items exsist, I want return true-

Which is the correct way to do this?

Thanks

phil

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org