[yabridgectl] Change the library architecture enum

We're going to need this for native libraries as well.
This commit is contained in:
Robbert van der Helm
2021-06-24 14:19:06 +02:00
parent cf6200fa1b
commit 3e0a2dc913
+12 -11
View File
@@ -237,18 +237,19 @@ impl Vst3Module {
} }
} }
/// The architecture of a `.dll` file. Needed so we can create a merged bundle for VST3 plugins. /// The architecture of a library file (either `.dll` or `.so` depending on the context). Needed so
/// we can create a merged bundle for VST3 plugins.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Copy)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Copy)]
pub enum LibArchitecture { pub enum LibArchitecture {
Dll32, Lib32,
Dll64, Lib64,
} }
impl Display for LibArchitecture { impl Display for LibArchitecture {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &self { match &self {
LibArchitecture::Dll32 => write!(f, "32-bit"), LibArchitecture::Lib32 => write!(f, "32-bit"),
LibArchitecture::Dll64 => write!(f, "64-bit"), LibArchitecture::Lib64 => write!(f, "64-bit"),
} }
} }
} }
@@ -258,8 +259,8 @@ impl LibArchitecture {
/// https://developer.steinberg.help/display/VST/Plug-in+Format+Structure#PluginFormatStructure-FortheWindowsplatform. /// https://developer.steinberg.help/display/VST/Plug-in+Format+Structure#PluginFormatStructure-FortheWindowsplatform.
pub fn vst_arch(&self) -> &str { pub fn vst_arch(&self) -> &str {
match &self { match &self {
LibArchitecture::Dll32 => "x86-win", LibArchitecture::Lib32 => "x86-win",
LibArchitecture::Dll64 => "x86_64-win", LibArchitecture::Lib64 => "x86_64-win",
} }
} }
} }
@@ -406,9 +407,9 @@ impl SearchIndex {
.into_par_iter() .into_par_iter()
.map(|path| { .map(|path| {
let architecture = if DLL32_AUTOMATON.is_match(pe32_info(&path)?) { let architecture = if DLL32_AUTOMATON.is_match(pe32_info(&path)?) {
LibArchitecture::Dll32 LibArchitecture::Lib32
} else { } else {
LibArchitecture::Dll64 LibArchitecture::Lib64
}; };
if VST2_AUTOMATON.is_match(exported_functions(&path)?) { if VST2_AUTOMATON.is_match(exported_functions(&path)?) {
@@ -428,9 +429,9 @@ impl SearchIndex {
.into_par_iter() .into_par_iter()
.map(|module_path| { .map(|module_path| {
let architecture = if DLL32_AUTOMATON.is_match(pe32_info(&module_path)?) { let architecture = if DLL32_AUTOMATON.is_match(pe32_info(&module_path)?) {
LibArchitecture::Dll32 LibArchitecture::Lib32
} else { } else {
LibArchitecture::Dll64 LibArchitecture::Lib64
}; };
if VST3_AUTOMATON.is_match(exported_functions(&module_path)?) { if VST3_AUTOMATON.is_match(exported_functions(&module_path)?) {