# get\_filename\_component name\_we / name\_wle: what is 'or' ?

**URL:** <https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370>\
**Category:** Code\
**Created:** [June 11, 2020, 10:45am UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370 "2020-06-11T10:45:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![davemilter](https://discourse.cmake.org/user_avatar/discourse.cmake.org/davemilter/32/541_2.png) [@davemilter](https://discourse.cmake.org/u/davemilter)\
**Post date:** [June 11, 2020, 10:45am UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370/1 "2020-06-11T10:45:25Z")

</div>

I can not understand documentation of [get\_filename\_component](https://cmake.org/cmake/help/git-master/command/get_filename_component.html) .

It describes:

```auto
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?

---

<div class="post-metadata">

**Author:** ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)\
**Post date:** [June 11, 2020, 11:18am UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370/2 "2020-06-11T11:18:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davemilter](https://discourse.cmake.org/user_avatar/discourse.cmake.org/davemilter/32/541_2.png) [@davemilter](https://discourse.cmake.org/u/davemilter)\
**Post date:** [June 11, 2020, 11:34am UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370/3 "2020-06-11T11:34:16Z")

</div>

> [@fenrir](#):
>
> 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?

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [June 11, 2020, 11:47am UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370/4 "2020-06-11T11:47:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![davemilter](https://discourse.cmake.org/user_avatar/discourse.cmake.org/davemilter/32/541_2.png) [@davemilter](https://discourse.cmake.org/u/davemilter)\
**Post date:** [June 11, 2020, 11:51am UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370/5 "2020-06-11T11:51:22Z")

</div>

> [@ben.boeckel](#):
>
> I think `without either the directory or the` may make it even clearer. Examples would help too

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

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [June 11, 2020, 12:05pm UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370/6 "2020-06-11T12:05:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)\
**Post date:** [June 11, 2020, 12:10pm UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370/7 "2020-06-11T12:10:07Z")

</div>

and if `any` is used?

```auto
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”.

---

<div class="post-metadata">

**Author:** ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)\
**Post date:** [June 11, 2020, 12:10pm UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370/8 "2020-06-11T12:10:07Z")

</div>

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”

> [@ben.boeckel](#):
>
> with neither the directory nor the X extension

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

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [November 10, 2020, 3:09pm UTC](https://discourse.cmake.org/t/get-filename-component-name-we-name-wle-what-is-or/1370/9 "2020-11-10T15:09:29Z")

</div>

MR for the improved wording: [https://gitlab.kitware.com/cmake/cmake/-/merge\_requests/5489](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5489)
