Skip to content

Commit 1cd88f9

Browse files
committed
fix: update extension reference
1 parent bbe9a4a commit 1cd88f9

2 files changed

Lines changed: 19 additions & 32 deletions

File tree

standalone/src-tauri/build.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,7 @@ fn prepare_sqlite_extension() {
4848

4949
let bin_dir = manifest_dir.join("bin");
5050
fs::create_dir_all(&bin_dir).expect("create bin directory");
51-
let dest = bin_dir.join(format!(
52-
"absurd-extension-{}{}",
53-
target_triple,
54-
if target_triple.contains("windows") {
55-
".exe"
56-
} else {
57-
""
58-
}
59-
));
51+
let dest = bin_dir.join("absurd-extension");
6052
fs::copy(&extension_path, &dest).expect("copy SQLite extension into resources");
6153
println!(
6254
"cargo:warning=Bundling absurd_sqlite_extension from {}",

standalone/src-tauri/src/db.rs

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,13 @@ impl DatabaseHandle {
9191
}
9292

9393
fn 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

Comments
 (0)