Skip to content

Commit c3c1429

Browse files
committed
fix: try from framework folder first
1 parent 21c5ba3 commit c3c1429

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

  • standalone/src-tauri/src

standalone/src-tauri/src/db.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,27 @@ fn resolve_extension_path(app_handle: &AppHandle) -> Option<PathBuf> {
140140
}
141141
}
142142

143+
#[cfg(target_os = "macos")]
144+
{
145+
// NOTE: On macOS, try to load from Frameworks first as the library is signed / notarized there
146+
if let Ok(resource_dir) = app_handle.path().resource_dir() {
147+
let frameworks_path = resource_dir
148+
.parent()
149+
.map(|contents_dir| contents_dir.join("Frameworks").join(&lib_name));
150+
if let Some(path) = frameworks_path {
151+
log::debug!("Checking Frameworks SQLite extension at {}", path.display());
152+
if path.exists() {
153+
log::info!("Using Frameworks SQLite extension at {}", path.display());
154+
return Some(path);
155+
}
156+
log::warn!(
157+
"SQLite extension not found in Frameworks at {}",
158+
path.display()
159+
);
160+
}
161+
}
162+
}
163+
143164
match app_handle.path().resource_dir() {
144165
Ok(resource_dir) => {
145166
let resource_path = resource_dir.join("resources").join(&lib_name);
@@ -158,24 +179,6 @@ fn resolve_extension_path(app_handle: &AppHandle) -> Option<PathBuf> {
158179
"SQLite extension not found in resources at {}",
159180
resource_path.display()
160181
);
161-
162-
#[cfg(target_os = "macos")]
163-
{
164-
let frameworks_path = resource_dir
165-
.parent()
166-
.map(|contents_dir| contents_dir.join("Frameworks").join(&lib_name));
167-
if let Some(path) = frameworks_path {
168-
log::debug!("Checking Frameworks SQLite extension at {}", path.display());
169-
if path.exists() {
170-
log::info!("Using Frameworks SQLite extension at {}", path.display());
171-
return Some(path);
172-
}
173-
log::warn!(
174-
"SQLite extension not found in Frameworks at {}",
175-
path.display()
176-
);
177-
}
178-
}
179182
}
180183
Err(err) => log::warn!("Failed to resolve resource directory: {}", err),
181184
}

0 commit comments

Comments
 (0)