When using a non-standard database location for nix-index (e.g. via the NixOS module in the github:Mic92/nix-index-database flake), comma warns that the database is non-existent even though it does exist and nix-locate works fine
This changes the logic so that it only checks if the database exists when the nix-locate command fails
The warning I receive without this patch
```
[I] lily@bina ~> , node
Warning: Nix-index database does not exist, try updating with `--update`.
Welcome to Node.js v18.12.1.
```
The output with this patch when nix-locate fails to find database
```
[I] lily@bina ~> , node
Warning: Nix-index database does not exist, try updating with `comma --update`.
nix-locate failed with: error: reading from the database at '/home/lily/.cache/nix-index/files' failed.
This may be caused by a corrupt or missing database, try (re)running `nix-index` to generate the database.
If the error persists please file a bug report at https://github.com/bennofs/nix-index.
caused by: No such file or directory (os error 2)
```
The output with this patch when nix-locate succeeds
```
[I] lily@bina ~> , node
Welcome to Node.js v18.12.1.
```
The output with this patch for an unknown binary
```
[I] lily@bina ~> , nonexistentbin
No executable `nonexistentbin` found in nix-index database.
```
When using a non-standard database location for nix-index (e.g. via the NixOS module in the
github:Mic92/nix-index-database
flake), comma warns that the database is non-existent even though it does exist and nix-locate works fineThis changes the logic so that it only checks if the database exists when the
nix-locate
command failsThe warning I receive without this patch
``` [I] lily@bina ~> , node Warning: Nix-index database does not exist, try updating with `--update`. Welcome to Node.js v18.12.1. ```The output with this patch when nix-locate fails to find database
``` [I] lily@bina ~> , node Warning: Nix-index database does not exist, try updating with `comma --update`. nix-locate failed with: error: reading from the database at '/home/lily/.cache/nix-index/files' failed. This may be caused by a corrupt or missing database, try (re)running `nix-index` to generate the database. If the error persists please file a bug report at https://github.com/bennofs/nix-index. caused by: No such file or directory (os error 2) ```The output with this patch when nix-locate succeeds
``` [I] lily@bina ~> , node Welcome to Node.js v18.12.1. ```The output with this patch for an unknown binary
``` [I] lily@bina ~> , nonexistentbin No executable `nonexistentbin` found in nix-index database. ```