Commit c7236aa8 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Debug output for file completion

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 019416f9
Pipeline #128 skipped
...@@ -39,6 +39,8 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil ...@@ -39,6 +39,8 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil
return NULL; return NULL;
} }
girara_debug("checking files in %s", current_path);
/* read directory */ /* read directory */
GDir* dir = g_dir_open(current_path, 0, NULL); GDir* dir = g_dir_open(current_path, 0, NULL);
if (dir == NULL) { if (dir == NULL) {
...@@ -79,20 +81,23 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil ...@@ -79,20 +81,23 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil
}; };
char* full_path = g_strdup_printf("%s%s%s", current_path, tmp, e_name); char* full_path = g_strdup_printf("%s%s%s", current_path, tmp, e_name);
g_free(e_name);
if (g_file_test(full_path, G_FILE_TEST_IS_DIR) == true) { if (g_file_test(full_path, G_FILE_TEST_IS_DIR) == true) {
if (show_directories == false) { if (show_directories == false) {
g_free(e_name); girara_debug("ignoring %s (directory)", full_path);
g_free(full_path); g_free(full_path);
continue; continue;
} }
girara_debug("adding %s (directory)", full_path);
girara_list_append(res, full_path); girara_list_append(res, full_path);
} else if (check_file_ext == false || file_valid_extension(zathura, full_path) == true) { } else if (check_file_ext == false || file_valid_extension(zathura, full_path) == true) {
girara_debug("adding %s (file)", full_path);
girara_list_append(res, full_path); girara_list_append(res, full_path);
} else { } else {
girara_debug("ignoring %s (file)", full_path);
g_free(full_path); g_free(full_path);
} }
g_free(e_name);
} }
g_dir_close(dir); g_dir_close(dir);
...@@ -200,6 +205,7 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext, in ...@@ -200,6 +205,7 @@ list_files_for_cc(zathura_t* zathura, const char* input, bool check_file_ext, in
const size_t path_len = strlen(path); const size_t path_len = strlen(path);
GIRARA_LIST_FOREACH(recent_files, const char*, iter, file) GIRARA_LIST_FOREACH(recent_files, const char*, iter, file)
if (strncmp(path, file, path_len) == 0) { if (strncmp(path, file, path_len) == 0) {
girara_debug("adding %s (recent file)", file);
girara_completion_group_add_element(history_group, file, NULL); girara_completion_group_add_element(history_group, file, NULL);
} }
GIRARA_LIST_FOREACH_END(recent_files, const char*, iter, file); GIRARA_LIST_FOREACH_END(recent_files, const char*, iter, file);
......
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