nushell/crates/nu-command/src/path
Wind 217eb4ed70
fix path exists on a non-directory file (#13763)
# Description
Fixes:  #13460

The issue is caused by `try_exists` method on path, it will return
`Err(NotADirectory)` if user tried to check for a path under a regular
file.
To fix it, I think it's ok to use `exists` rather than `try_exists`,
although
[Path::exists()](https://doc.rust-lang.org/std/path/struct.Path.html#method.exists)
only checks whether or not a path was both found and readable. I think
it's ok, and we can add this information under `extra_description`.

# User-Facing Changes
The following code will no longer raise error:
```
touch a; 'a/b' | path exists
```

# Tests + Formatting
Added 1 test.
2024-09-11 12:45:39 -05:00
..
basename.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
dirname.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
exists.rs fix path exists on a non-directory file (#13763) 2024-09-11 12:45:39 -05:00
expand.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
join.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
mod.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
parse.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
path_.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
relative_to.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
split.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
type.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00