@@ -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 < ( ) > ;
@@ -578,11 +577,19 @@ where
578577impl BaseStore for BaseStoreImpl {
579578 #[ inline]
580579 async fn is_valid_path ( & self , path : & StorePath ) -> bool {
581- let store = self . wrapper . clone ( ) ;
582580 let path = self . print_store_path ( path) ;
583- asyncify ( move || ffi:: is_valid_path ( store. as_raw ( ) , & path) )
584- . await
585- . unwrap_or ( false )
581+ let uri = self . uri . clone ( ) ;
582+ asyncify_anyhow ( move || -> Result < bool , Error > {
583+ let store_uri = if uri. is_empty ( ) { None } else { Some ( uri. as_str ( ) ) } ;
584+ let mut nbs = nix_bindings_store:: store:: Store :: open (
585+ store_uri,
586+ std:: iter:: empty :: < ( & str , & str ) > ( ) ,
587+ ) ?;
588+ let nbs_path = nbs. parse_store_path ( & path) ?;
589+ Ok ( nbs. is_valid_path ( & nbs_path) )
590+ } )
591+ . await
592+ . unwrap_or ( false )
586593 }
587594
588595 #[ inline]
0 commit comments