changeset 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 64d45f526afc
files host/vamp-simple-host.cpp vamp-sdk/hostext/PluginLoader.cpp vamp-sdk/hostext/PluginLoader.h
diffstat 3 files changed, 33 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/host/vamp-simple-host.cpp	Wed Jun 06 12:20:16 2007 +0000
+++ b/host/vamp-simple-host.cpp	Wed Jun 06 12:49:55 2007 +0000
@@ -78,13 +78,16 @@
         "  " << name << " pluginlibrary[." << PLUGIN_SUFFIX << "]:plugin[:output] file.wav\n"
         "  " << name << " pluginlibrary[." << PLUGIN_SUFFIX << "]:plugin file.wav [outputno]\n\n"
         "    -- Load plugin id \"plugin\" from \"pluginlibrary\" and run it on the\n"
-        "       audio data in \"file.wav\"; retrieve the named \"output\", or output\n"
-        "       number \"outputno\" (the first output by default) and dump it to\n"
+        "       audio data in \"file.wav\", retrieving the named \"output\", or output\n"
+        "       number \"outputno\" (the first output by default) and dumping it to\n"
         "       standard output.\n\n"
+        "       \"pluginlibrary\" should be a library name, not a file path; the\n"
+        "       standard Vamp library search path will be used to locate it.  If\n"
+        "       a file path is supplied, the directory part(s) will be ignored.\n\n"
         "  " << name << " -l\n\n"
-        "    -- List the plugin libraries and Vamp plugins in the plugin search path.\n\n"
+        "    -- List the plugin libraries and Vamp plugins in the library search path.\n\n"
         "  " << name << " -p\n\n"
-        "    -- Print out the Vamp plugin search path.\n\n"
+        "    -- Print out the Vamp library search path.\n\n"
         "  " << name << " -v\n\n"
         "    -- Display version information only.\n\n"
          << endl;
--- 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;
 }
 
--- a/vamp-sdk/hostext/PluginLoader.h	Wed Jun 06 12:20:16 2007 +0000
+++ b/vamp-sdk/hostext/PluginLoader.h	Wed Jun 06 12:49:55 2007 +0000
@@ -75,13 +75,22 @@
     /**
      * PluginKey is a string type that is used to identify a plugin
      * uniquely within the scope of "the current system".  It consists
-     * of the base name of the plugin library, a colon separator, and
-     * the identifier string for the plugin.  It is only meaningful in
-     * the context of a given plugin path (the one returned by
-     * PluginHostAdapter::getPluginPath()).
+     * of the lower-cased base name of the plugin library, a colon
+     * separator, and the identifier string for the plugin.  It is
+     * only meaningful in the context of a given plugin path (the one
+     * returned by PluginHostAdapter::getPluginPath()).
      *
      * Use composePluginKey to construct a plugin key from a known
      * plugin library name and identifier.
+     *
+     * Note: the fact that the library component of the key is
+     * lower-cased implies that library names are matched
+     * case-insensitively by the PluginLoader class, regardless of the
+     * case sensitivity of the underlying filesystem.  (Plugin
+     * identifiers _are_ case sensitive, however.)  Also, it is not
+     * possible to portably extract a working library name from a
+     * plugin key, as the result may fail on case-sensitive
+     * filesystems.  Use getLibraryPathForPlugin instead.
      */
     typedef std::string PluginKey;