@@ -134,7 +134,6 @@ mod ffi {
134134 fn get_build_dir ( ) -> String ;
135135 fn get_log_dir ( ) -> String ;
136136 fn get_state_dir ( ) -> String ;
137- fn is_valid_path ( store : & StoreWrapper , path : & str ) -> Result < bool > ;
138137 fn query_path_info ( store : & StoreWrapper , path : & str ) -> Result < InternalPathInfo > ;
139138 fn compute_closure_size ( store : & StoreWrapper , path : & str ) -> Result < u64 > ;
140139 fn clear_path_info_cache ( store : & StoreWrapper ) -> Result < ( ) > ;
@@ -581,11 +580,19 @@ where
581580impl BaseStore for BaseStoreImpl {
582581 #[ inline]
583582 async fn is_valid_path ( & self , path : & StorePath ) -> bool {
584- let store = self . wrapper . clone ( ) ;
585583 let path = self . print_store_path ( path) ;
586- asyncify ( move || ffi:: is_valid_path ( store. as_raw ( ) , & path) )
587- . await
588- . unwrap_or ( false )
584+ let uri = self . uri . clone ( ) ;
585+ asyncify_anyhow ( move || -> Result < bool , Error > {
586+ let store_uri = if uri. is_empty ( ) { None } else { Some ( uri. as_str ( ) ) } ;
587+ let mut nbs = nix_bindings_store:: store:: Store :: open (
588+ store_uri,
589+ std:: iter:: empty :: < ( & str , & str ) > ( ) ,
590+ ) ?;
591+ let nbs_path = nbs. parse_store_path ( & path) ?;
592+ Ok ( nbs. is_valid_path ( & nbs_path) )
593+ } )
594+ . await
595+ . unwrap_or ( false )
589596 }
590597
591598 #[ inline]
0 commit comments