get_filename_component name_we / name_wle: what is 'or' ?

I can not understand documentation of get_filename_component .

It describes:

NAME_WE   = File name without directory or longest extension
NAME_WLE  = File name without directory or last extension

What does it mean? If and was used here instead of or this would be what I want.
But what or means? It removes randomly one of this variants:

  • directory
  • longest extension
  • both: directory, longest extension

?
How it choose what to remove?

This is how English grammar works (as a non-native speaker I love those details).
It means both.

The funny thing is with and it could also be interpreted wrongly as returning two things.

But the context is removing, not returning things. So with and it would be interpreted in the right way as removing two things?

I think without either the directory or the may make it even clearer. Examples would help too.

1 Like

But it is nonsense remove just directory or just extension, NAME_WE suggest that actually should be removed both. either looks completly wrong?

Hrm, yeah, it still is ambiguous parsing. English needs order of operations :slight_smile: . Would with neither the directory nor the X extension read more clearly?

and if any is used?

NAME_WE   = File name without any directory or longest extension
NAME_WLE  = File name without any directory or last extension

it would be read as “without any of these”.

There are many ways to put it. The original is correct and clear to me (in English you have to resolve parsing ambiguities in favour of the interpretation that makes the most sense).
“without” can also be used with “nor”

I don’t know if you could formulate it clearer than that.

1 Like

MR for the improved wording: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5489