gplugin/gplugin

Fix a bug where we were treating directories like files
bugfix/valgrind-catchup
2020-02-29, Gary Kramlich
a73f8b831ec1
Parents e96a77b70793
Children 6153361d779d
Fix a bug where we were treating directories like files
--- a/gplugin/gplugin-file-tree.c Thu Feb 27 03:56:31 2020 -0600
+++ b/gplugin/gplugin-file-tree.c Sat Feb 29 00:41:34 2020 -0600
@@ -120,11 +120,16 @@
/* now run through all of the files and add then to the dir node */
while((filename = g_dir_read_name(dir)) != NULL) {
GNode *file = NULL;
+ gchar *test_filename = g_build_filename(path, filename, NULL);
- entry = gplugin_file_tree_entry_new(filename);
- file = g_node_new(entry);
+ if(g_file_test(test_filename, G_FILE_TEST_IS_REGULAR)) {
+ entry = gplugin_file_tree_entry_new(filename);
+ file = g_node_new(entry);
- g_node_prepend(node_dir, file);
+ g_node_prepend(node_dir, file);
+ }
+
+ g_free(test_filename);
}
/* close the dir */