It returns true if the path is a directory that can be read, or if it is not a directory and can be opened as a file in read-only mode. This is being added to allow conditions to guard against trying to read the version of an executable that exists but is unreadable, e.g. any of the official game executables for games installed through the Microsoft Store or Xbox app. The Windows test for evaling with an unreadable file doesn't use a file that's unreadable for the same reason as what's motivating this new function, but the error that is handled when checking the file is the same kind (permission denied).
loot-condition-interpreter
A library for parsing and evaluating LOOT's metadata condition strings. It provides:
- Support for metadata syntax v0.15 condition strings.
- Condition string parsing without evaluation, for checking syntax.
- Evaluation of parsed condition strings.
- Efficient and safe concurrent condition evaluation thanks to Rust's safety guarantees.
- Caching of individual function evaluation results and calculated CRCs.
- Executable version parsing without any external runtime dependencies.
- Lots of tests, and benchmarks.
- A C FFI library that wraps the Rust library.
Build
Make sure you have Rust installed.
To build the Rust and C FFI libraries, run:
cargo build --release --package loot-condition-interpreter-ffi
To generate a C++ header file as part of the build, instead run:
cargo build --release --package loot-condition-interpreter-ffi --all-features
This will create a file at ffi/include/loot_condition_interpreter.h.
However, this involves building cbindgen
as a dependency, which is relatively slow. If you have cbindgen installed
separately, it's faster to generate the headers using its CLI:
cbindgen ffi/ -o ffi/include/loot_condition_interpreter.h
Tests & Benchmarks
The tests and benchmarks need the testing-plugins and the LOOT API v0.13.8 Windows archives to be extracted and present in the repo root. See the GitHub Actions CI workflow for examples on what should be extracted where.
To run the Rust tests:
cargo test --all
To run the benchmarks:
cargo bench
There are also C++ tests for the FFI library, they require a C++ toolchain and CMake to be installed. To run the C++ tests:
mkdir ffi/build
cd ffi/build
cmake ..
cmake --build .
ctest