コード例 #1
0
ファイル: plugin.c プロジェクト: ivan-dives/audacious-plugins
static void open_modules_for_path (const char * path)
{
    DIR * folder = opendir (path);
    if (! folder)
    {
        fprintf (stderr, "ladspa: Failed to read folder %s: %s\n", path, strerror (errno));
        return;
    }

    struct dirent * entry;
    while ((entry = readdir (folder)))
    {
        if (entry->d_name[0] == '.' || ! str_has_suffix_nocase (entry->d_name, G_MODULE_SUFFIX))
            continue;

        char filename[strlen (path) + strlen (entry->d_name) + 2];
        snprintf (filename, sizeof filename, "%s" G_DIR_SEPARATOR_S "%s", path, entry->d_name);

        void * handle = open_module (filename);
        if (handle)
            index_append (modules, handle);
    }

    closedir (folder);
}
コード例 #2
0
static void open_modules_for_path (const char * path)
{
    GDir * folder = g_dir_open (path, 0, NULL);
    if (! folder)
    {
        fprintf (stderr, "ladspa: Failed to read folder %s: %s\n", path, strerror (errno));
        return;
    }

    const char * name;
    while ((name = g_dir_read_name (folder)))
    {
        if (! str_has_suffix_nocase (name, G_MODULE_SUFFIX))
            continue;

        char * filename = filename_build (path, name);
        void * handle = open_module (filename);

        if (handle)
            index_insert (modules, -1, handle);

        str_unref (filename);
    }

    g_dir_close (folder);
}
コード例 #3
0
static gboolean ffaudio_write_tag (const char * filename, VFSFile * file, const Tuple * tuple)
{
    if (! file)
        return FALSE;

    if (str_has_suffix_nocase (vfs_get_filename (file), ".ape"))
        return tag_tuple_write(tuple, file, TAG_TYPE_APE);

    return tag_tuple_write(tuple, file, TAG_TYPE_NONE);
}
コード例 #4
0
static bool_t scan_plugin_func(const char * path, const char * basename, gpointer data)
{
    if (!str_has_suffix_nocase(basename, SHARED_SUFFIX))
        return FALSE;

    if (!g_file_test(path, G_FILE_TEST_IS_REGULAR))
        return FALSE;

    plugin_register (path);

    return FALSE;
}
コード例 #5
0
ファイル: pluginenum.c プロジェクト: umurkontaci/audacious
static bool_t scan_plugin_func(const char * path, const char * basename, void * data)
{
    if (!str_has_suffix_nocase(basename, PLUGIN_SUFFIX))
        return FALSE;

    struct stat st;
    if (stat (path, & st))
    {
        fprintf (stderr, "Unable to stat %s: %s\n", path, strerror (errno));
        return FALSE;
    }

    if (S_ISREG (st.st_mode))
        plugin_register (path, st.st_mtime);

    return FALSE;
}
コード例 #6
0
ファイル: util.c プロジェクト: Pitxyoki/audacious-plugins
gchar *archive_basename(const gchar *str)
{
    gint i = 0;

    while (archive_extensions[i].ext)
    {
        if (str_has_suffix_nocase(str, archive_extensions[i].ext))
        {
            const gchar *end = g_strrstr(str, archive_extensions[i].ext);
            if (end)
            {
                return g_strndup(str, end - str);
            }
            break;
        }
        i++;
    }

    return NULL;
}