Remove warnings when using bt_plugin_create_all_from_dir()
[babeltrace.git] / lib / plugin / plugin.c
index 9518b8eaa4e3578e7e9cdc79a887a3ee92ba8078..a1a522ecb4cc6068692e8519a0769bc82be6ce6e 100644 (file)
@@ -269,6 +269,16 @@ struct bt_plugin *bt_plugin_find(const char *plugin_name)
 
                BT_PUT(plugin_set);
 
+               /*
+                * Skip this if the directory does not exist because
+                * bt_plugin_create_all_from_dir() would log a warning.
+                */
+               if (!g_file_test(dir->str, G_FILE_TEST_IS_DIR)) {
+                       BT_LOGV("Skipping nonexistent directory path: "
+                               "path=\"%s\"", dir->str);
+                       continue;
+               }
+
                /* bt_plugin_create_all_from_dir() logs details/errors */
                plugin_set = bt_plugin_create_all_from_dir(dir->str, BT_FALSE);
                if (!plugin_set) {
@@ -456,6 +466,7 @@ enum bt_plugin_status bt_plugin_create_append_all_from_dir(
 
                if (strcmp(result->d_name, ".") == 0 ||
                                strcmp(result->d_name, "..") == 0) {
+                       /* Obviously not logging this */
                        continue;
                }
 
This page took 0.023492 seconds and 4 git commands to generate.