openPMD / openPMD-validator

:ballot_box_with_check: Validator and Example Scripts
ISC License
4 stars 8 forks source link

Validator crashes when `meshesPath` does not have a trailing slash. #43

Closed RemiLehe closed 6 years ago

RemiLehe commented 6 years ago

When meshesPath does not have a trailing slash (/), then the code crashes.

This is essentially because the code in check_h5.py forms paths by using + on strings, instead of os.path.join.

In fact, I think that the standard is somewhat unclear on whether meshesPath should end with a /. @ax3l : What do you think?

ax3l commented 6 years ago

Thanks for catching this!

I think imposing the final / makes implementations easier (good!) while cluttering the standard with details a little. A path join operation is in principle the logical way to implement it (available in Python and modern C++) which then would be agnostic. Nevertheless some very rudimentary languages might not have such high-level functionality.

The example currently shows a trailing / and I think it might make things indeed easier for implementations which I favor for the community.

Let's discuss this today!

DavidSagan commented 6 years ago

Since "//" is equivalent to "/" in a path one can always use

A+"/"+B

if a join function is not available.

ax3l commented 6 years ago

That's right :) But maybe - nah, it's kind of a hack :-) and won't work if your file format is a bit... special... (ADIOS1 paths are only maps with string keys, don't let us stress those)