aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index 738fd6f61..0aea01d83 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -1,6 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use std::{ 3use std::{
4 ffi::OsStr,
4 ops, 5 ops,
5 path::{Path, PathBuf}, 6 path::{Path, PathBuf},
6}; 7};
@@ -299,7 +300,10 @@ pub fn load_extern_resources(cargo_toml: &Path, cargo_features: &CargoFeatures)
299 Message::CompilerArtifact(message) => { 300 Message::CompilerArtifact(message) => {
300 if message.target.kind.contains(&"proc-macro".to_string()) { 301 if message.target.kind.contains(&"proc-macro".to_string()) {
301 let package_id = message.package_id; 302 let package_id = message.package_id;
302 if let Some(filename) = message.filenames.get(0) { 303 // Skip rmeta file
304 if let Some(filename) =
305 message.filenames.iter().filter(|name| is_dylib(name)).next()
306 {
303 acc.proc_dylib_paths.insert(package_id, filename.clone()); 307 acc.proc_dylib_paths.insert(package_id, filename.clone());
304 } 308 }
305 } 309 }
@@ -316,3 +320,11 @@ pub fn load_extern_resources(cargo_toml: &Path, cargo_features: &CargoFeatures)
316 320
317 acc 321 acc
318} 322}
323
324// FIXME: File a better way to know if it is a dylib
325fn is_dylib(path: &Path) -> bool {
326 match path.extension().and_then(OsStr::to_str).map(|it| it.to_string().to_lowercase()) {
327 None => false,
328 Some(ext) => matches!(ext.as_str(), "dll" | "dylib" | "so"),
329 }
330}