diff vamp-sdk/hostext/PluginLoader.cpp @ 73:6d16c376fd2f

* Make library name case-insensitive in PluginLoader * Some doc updates
author cannam
date Wed, 06 Jun 2007 12:49:55 +0000
parents 65add4f460e9
children 0f8524203677
line wrap: on
line diff
--- a/vamp-sdk/hostext/PluginLoader.cpp	Wed Jun 06 12:20:16 2007 +0000
+++ b/vamp-sdk/hostext/PluginLoader.cpp	Wed Jun 06 12:49:55 2007 +0000
@@ -212,11 +212,17 @@
              fi != files.end(); ++fi) {
             
             if (libraryName != "") {
-                string::size_type pi = fi->find('.');
+                // libraryName is lowercased and lacking an extension,
+                // as it came from the plugin key
+                string temp = *fi;
+                for (size_t i = 0; i < temp.length(); ++i) {
+                    temp[i] = std::tolower(temp[i]);
+                }
+                string::size_type pi = temp.find('.');
                 if (pi == string::npos) {
-                    if (libraryName != *fi) continue;
+                    if (libraryName != temp) continue;
                 } else {
-                    if (libraryName != fi->substr(0, pi)) continue;
+                    if (libraryName != temp.substr(0, pi)) continue;
                 }
             }
 
@@ -260,8 +266,6 @@
 PluginLoader::PluginKey
 PluginLoader::Impl::composePluginKey(string libraryName, string identifier)
 {
-    //!!! deal with case issues
-    
     string basename = libraryName;
 
     string::size_type li = basename.rfind('/');
@@ -270,6 +274,10 @@
     li = basename.find('.');
     if (li != string::npos) basename = basename.substr(0, li);
 
+    for (size_t i = 0; i < basename.length(); ++i) {
+        basename[i] = std::tolower(basename[i]);
+    }
+
     return basename + ":" + identifier;
 }