Remove warnings when using bt_plugin_create_all_from_dir()
[babeltrace.git] / cli / babeltrace.c
index 9de233bc1672718ec3bc3c31cd029b469a3e0b60..fbf611417130c5c47c49879ce1764b278b7925ef 100644 (file)
@@ -581,6 +581,19 @@ int load_dynamic_plugins(struct bt_value *plugin_paths)
                plugin_path_value = bt_value_array_get(plugin_paths, i);
                bt_value_string_get(plugin_path_value, &plugin_path);
                assert(plugin_path);
+
+               /*
+                * Skip this if the directory does not exist because
+                * bt_plugin_create_all_from_dir() expects an existing
+                * directory.
+                */
+               if (!g_file_test(plugin_path, G_FILE_TEST_IS_DIR)) {
+                       BT_LOGV("Skipping nonexistent directory path: "
+                               "path=\"%s\"", plugin_path);
+                       BT_PUT(plugin_path_value);
+                       continue;
+               }
+
                plugin_set = bt_plugin_create_all_from_dir(plugin_path, false);
                if (!plugin_set) {
                        BT_LOGD("Unable to load dynamic plugins: path=\"%s\"",
This page took 0.022467 seconds and 4 git commands to generate.