From 2ed073f0e3f7c5103aba43a2c2db4c37a2a5283e Mon Sep 17 00:00:00 2001 From: Deluvi Date: Mon, 25 Feb 2019 16:40:55 +0100 Subject: [PATCH] Fix multiple versions of the same dynamic lib used --- dinghy-lib/src/compiler.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dinghy-lib/src/compiler.rs b/dinghy-lib/src/compiler.rs index f0b4bffa..e6048c25 100644 --- a/dinghy-lib/src/compiler.rs +++ b/dinghy-lib/src/compiler.rs @@ -25,6 +25,7 @@ use Runnable; use std::collections::HashSet; use std::env; use std::env::current_dir; +use std::ffi::OsString; use std::fs; use std::fs::File; use std::io::prelude::*; @@ -489,6 +490,15 @@ fn find_dynamic_libraries(compilation: &Compilation, .filter_map(|walk_entry| walk_entry.map(|it| it.path().to_path_buf()).ok()) .filter(|path| is_library(path) && is_library_linked_to_project(path)) .filter(|path| is_banned(path)) + .fold(Vec::new(), |mut acc : Vec, x| { + if !acc.iter().find(|x1| x.file_name().unwrap_or(&OsString::from("")) == x1.file_name().unwrap_or(&OsString::from(""))).is_some() { //If there is not yet a copy of the lib file in the vector + acc.push(x); + acc + } + else { + acc + } + }).into_iter() .inspect(|path| debug!("Found library {}", path.display())) .collect()) }