Set file path for file lock in mod cargo_config

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
Jiahao XU 2025-02-22 22:57:04 +11:00 committed by GitHub
parent d224e820be
commit 3e5f41e27e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -138,7 +138,7 @@ impl Config {
fn inner(path: &Path) -> Result<Config, ConfigLoadError> {
match File::open(path) {
Ok(file) => {
let file = FileLock::new_shared(file)?;
let file = FileLock::new_shared(file)?.set_file_path(path);
// Any regular file must have a parent dir
Config::load_from_reader(file, path.parent().unwrap())
}