humble-video-noarch/src/main/java/io/humble/ferry/JNILibraryLoader.java
List<String> getLibraryCandidates(String aLibraryName, Long aMajorVersion)
  {
    final List<String> retval = new LinkedList<String>();
    // Note: when done each of these variables must be set to a non-null, non
    // empty string array
    final String[] prefixes;
    final String[] suffixes;
    final String[] preSuffixVersions;
    final String[] postSuffixVersions;

    switch (getOS())
    {
      case Unknown:
      case Linux:
        prefixes = new String[]
        {
            "lib", ""
        };
        suffixes = new String[]
        {
          ".so"
        };
        preSuffixVersions = new String[]
        {
          ""
        };
        postSuffixVersions = (aMajorVersion == null ? new String[]
        {
          ""
        } : new String[]
        {
          "." + aMajorVersion.longValue()
        });
        break;
      case Windows:
        prefixes = new String[]
        {
            "lib", "", "cyg"
        };
        suffixes = new String[]
        {
          ".dll"
        };
        preSuffixVersions = (aMajorVersion == null ? new String[]
        {
          ""
        } : new String[]
        {
          "-" + aMajorVersion.longValue()
        });
        postSuffixVersions = new String[]
        {
          ""
        };
        break;
      case MacOSX:
        prefixes = new String[]
        {
            "lib", ""
        };
        suffixes = new String[]
        {
          ".dylib"
        };
        preSuffixVersions = (aMajorVersion == null ? new String[]
        {
          ""
        } : new String[]
        {
          "." + aMajorVersion.longValue()
        });
        postSuffixVersions = new String[]
        {
          ""
        };
        break;
      default:
        // really no cases should get here
        prefixes = null;
        suffixes = null;
        preSuffixVersions = null;
        postSuffixVersions = null;
        break;
    }
    initializeSearchPaths();

    // First check the versioned paths
    if (aMajorVersion != null)
    {
      for (String directory : mJavaPropPaths)
      {
        generateFileNames(retval, directory, aLibraryName, prefixes, suffixes,
            preSuffixVersions, postSuffixVersions, true);
      }
      for (String directory : mJavaEnvPaths)
      {
        generateFileNames(retval, directory, aLibraryName, prefixes, suffixes,
            preSuffixVersions, postSuffixVersions, true);
      }
    }
    for (String directory : mJavaPropPaths)
    {
      generateFileNames(retval, directory, aLibraryName, prefixes, suffixes,
          preSuffixVersions, postSuffixVersions, false);
    }
    for (String directory : mJavaEnvPaths)
    {
      generateFileNames(retval, directory, aLibraryName, prefixes, suffixes,
          preSuffixVersions, postSuffixVersions, false);
    }
    return retval;
  }
List<String> getLibraryCandidates(String aLibraryName, Long aMajorVersion)
  {
    final List<String> retval = new LinkedList<String>();
    // Note: when done each of these variables must be set to a non-null, non
    // empty string array
    final String[] prefixes;
    final String[] suffixes;
    final String[] preSuffixVersions;
    final String[] postSuffixVersions;

    switch (getOS())
    {
      case Unknown:
      case Linux:
        prefixes = new String[]
        {
            "lib", ""
        };
        suffixes = new String[]
        {
          ".so"
        };
        preSuffixVersions = new String[]
        {
          ""
        };
        postSuffixVersions = (aMajorVersion == null ? new String[]
        {
          ""
        } : new String[]
        {
          "." + aMajorVersion.longValue()
        });
        break;
      case Windows:
        prefixes = new String[]
        {
            "lib", "", "cyg"
        };
        suffixes = new String[]
        {
          ".dll"
        };
        preSuffixVersions = (aMajorVersion == null ? new String[]
        {
          ""
        } : new String[]
        {
          "-" + aMajorVersion.longValue()
        });
        postSuffixVersions = new String[]
        {
          ""
        };
        break;
      case MacOSX:
        prefixes = new String[]
        {
            "lib", ""
        };
        suffixes = new String[]
        {
          ".dylib"
        };
        preSuffixVersions = (aMajorVersion == null ? new String[]
        {
          ""
        } : new String[]
        {
          "." + aMajorVersion.longValue()
        });
        postSuffixVersions = new String[]
        {
          ""
        };
        break;
      default:
        // really no cases should get here
        prefixes = null;
        suffixes = null;
        preSuffixVersions = null;
        postSuffixVersions = null;
        break;
    }
    initializeSearchPaths();

    // First check the versioned paths
    if (aMajorVersion != null)
    {
      for (String directory : mJavaPropPaths)
      {
        generateFileNames(retval, directory, aLibraryName, prefixes, suffixes,
            preSuffixVersions, postSuffixVersions, true);
      }
      for (String directory : mJavaEnvPaths)
      {
        generateFileNames(retval, directory, aLibraryName, prefixes, suffixes,
            preSuffixVersions, postSuffixVersions, true);
      }
    }
    for (String directory : mJavaPropPaths)
    {
      generateFileNames(retval, directory, aLibraryName, prefixes, suffixes,
          preSuffixVersions, postSuffixVersions, false);
    }
    for (String directory : mJavaEnvPaths)
    {
      generateFileNames(retval, directory, aLibraryName, prefixes, suffixes,
          preSuffixVersions, postSuffixVersions, false);
    }
    return retval;
  }
For a given library, and the OS we're running on, this method generates a
list of potential absolute file paths that
{@link #loadCandidateLibrary(String, Long, String[])} should attempt (in
order) to load. This method will not check for existence and readability of
the file we're attempting to load.

@param aLibraryName
The library name
@param aMajorVersion
The version, or null if we don't care.
@return The set of absolute file paths to try.