Add a plugin type tag and conversion functions

This commit is contained in:
Robbert van der Helm
2020-11-30 21:51:28 +01:00
parent 47baef3107
commit 67388dc2a6
2 changed files with 38 additions and 2 deletions
+21 -1
View File
@@ -5,7 +5,7 @@
namespace fs = boost::filesystem;
LibArchitecture find_dll_architecture(fs::path plugin_path) {
LibArchitecture find_dll_architecture(const fs::path& plugin_path) {
std::ifstream file(plugin_path, std::ifstream::binary | std::ifstream::in);
// The linker will place the offset where the PE signature is placed at the
@@ -51,3 +51,23 @@ LibArchitecture find_dll_architecture(fs::path plugin_path) {
<< std::hex << machine_type;
throw std::runtime_error(error_msg.str());
}
PluginType plugin_type_from_string(const std::string& plugin_type) {
if (plugin_type == "vst2") {
return PluginType::vst2;
} else if (plugin_type == "vst3") {
return PluginType::vst3;
} else {
return PluginType::unknown;
}
}
std::string plugin_type_to_string(const PluginType& plugin_type) {
if (plugin_type == PluginType::vst2) {
return "vst2";
} else if (plugin_type == PluginType::vst3) {
return "vst3";
} else {
return "unknown";
}
}