Commit dc027f53 authored by Gonzalo Garramuno's avatar Gonzalo Garramuno Committed by Ralph Giles

Added environment variable AO_PLUGIN_PATH.

This optional environment variable controls where libao looks for its plug-ins.  This allows you to easily deploy libao in a separate distribution from its normal path location or configure setting (/usr/local/lib/ao/plugins-4 by default).
parent 587d5721
Pipeline #1966 passed with stage
in 56 seconds
......@@ -295,13 +295,18 @@ static void _append_dynamic_drivers(driver_list *end)
ao_device *device = ao_global_dummy;
/* now insert any plugins we find */
plugindir = opendir(AO_PLUGIN_PATH);
adebug("Loading driver plugins from %s...\n",AO_PLUGIN_PATH);
if (plugindir != NULL) {
const char* pluginpath = AO_PLUGIN_PATH;
char* env = getenv( "AO_PLUGIN_PATH" );
if ( env ) {
pluginpath = env;
}
plugindir = opendir(pluginpath);
adebug("Loading driver plugins from %s...\n",pluginpath);
if (plugindir != NULL) {
while ((plugin_dirent = readdir(plugindir)) != NULL) {
char fullpath[strlen(AO_PLUGIN_PATH) + 1 + strlen(plugin_dirent->d_name) + 1];
char fullpath[strlen(pluginpath) + 1 + strlen(plugin_dirent->d_name) + 1];
snprintf(fullpath, sizeof(fullpath), "%s/%s",
AO_PLUGIN_PATH, plugin_dirent->d_name);
pluginpath, plugin_dirent->d_name);
if (!stat(fullpath, &statbuf) &&
S_ISREG(statbuf.st_mode) &&
(ext = strrchr(plugin_dirent->d_name, '.')) != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment