@@ -91,24 +91,13 @@ impl DatabaseHandle {
9191}
9292
9393fn resolve_extension_path ( app_handle : & AppHandle ) -> Option < PathBuf > {
94- let triple = std:: env:: var ( "TAURI_TARGET_TRIPLE" ) . unwrap_or_else ( |_| "unknown" . to_string ( ) ) ;
95- let bin_name = format ! (
96- "absurd-extension-{}{}" ,
97- triple,
98- if cfg!( target_os = "windows" ) {
99- ".exe"
100- } else {
101- ""
102- }
103- ) ;
104-
105- if let Ok ( path) = app_handle
94+ let mut candidates: Vec < ( & str , PathBuf ) > = Vec :: new ( ) ;
95+ match app_handle
10696 . path ( )
107- . resolve ( Path :: new ( "bin" ) . join ( & bin_name ) , BaseDirectory :: Resource )
97+ . resolve ( Path :: new ( "bin" ) . join ( "absurd-extension" ) , BaseDirectory :: Resource )
10898 {
109- if path. exists ( ) {
110- return Some ( path) ;
111- }
99+ Ok ( path) => candidates. push ( ( "bundled" , path) ) ,
100+ Err ( err) => log:: debug!( "Failed to resolve bundled extension path: {}" , err) ,
112101 }
113102
114103 let manifest_dir = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
@@ -118,15 +107,21 @@ fn resolve_extension_path(app_handle: &AppHandle) -> Option<PathBuf> {
118107 . unwrap_or ( & manifest_dir) ;
119108 let target_dir = workspace_root. join ( "target" ) ;
120109 let lib_name = extension_lib_name ( ) ;
121- let debug_path = target_dir. join ( "debug" ) . join ( & lib_name) ;
122- if debug_path. exists ( ) {
123- return Some ( debug_path) ;
124- }
125- let release_path = target_dir. join ( "release" ) . join ( & lib_name) ;
126- if release_path. exists ( ) {
127- return Some ( release_path) ;
110+ candidates. push ( ( "debug build" , target_dir. join ( "debug" ) . join ( & lib_name) ) ) ;
111+ candidates. push ( ( "release build" , target_dir. join ( "release" ) . join ( & lib_name) ) ) ;
112+
113+ for ( label, path) in candidates {
114+ log:: debug!( "Checking {} SQLite extension at {}" , label, path. display( ) ) ;
115+ if path. exists ( ) {
116+ log:: info!( "Using {} SQLite extension at {}" , label, path. display( ) ) ;
117+ return Some ( path) ;
118+ }
128119 }
129120
121+ log:: warn!(
122+ "SQLite extension not found. Checked bundled resource and build outputs in {}" ,
123+ target_dir. display( )
124+ ) ;
130125 None
131126}
132127
0 commit comments