mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 22:25:59 +01:00
Simplify zathura_document_plugins_load.
This commit is contained in:
parent
1bccf8846f
commit
393fb2a2b6
1 changed files with 1 additions and 18 deletions
19
document.c
19
document.c
|
@ -8,11 +8,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <gio/gio.h>
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
#include "document.h"
|
#include "document.h"
|
||||||
|
@ -48,22 +46,7 @@ zathura_document_plugins_load(zathura_t* zathura)
|
||||||
char* name = NULL;
|
char* name = NULL;
|
||||||
while ((name = (char*) g_dir_read_name(dir)) != NULL) {
|
while ((name = (char*) g_dir_read_name(dir)) != NULL) {
|
||||||
char* path = g_build_filename(plugindir, name, NULL);
|
char* path = g_build_filename(plugindir, name, NULL);
|
||||||
GFile* file = g_file_new_for_path(path);
|
if (g_file_test(path, G_FILE_TEST_IS_REGULAR) == 0) {
|
||||||
GError* error = NULL;
|
|
||||||
GFileInfo* file_info = g_file_query_info(file, G_FILE_ATTRIBUTE_UNIX_MODE, 0, NULL, &error);
|
|
||||||
if (file_info == NULL) {
|
|
||||||
girara_error("failed to query file info for %s: %s", path, error->message);
|
|
||||||
g_error_free(error);
|
|
||||||
g_object_unref(file);
|
|
||||||
g_free(path);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const guint mode = g_file_info_get_attribute_uint32(file_info, G_FILE_ATTRIBUTE_UNIX_MODE);
|
|
||||||
g_object_unref(file_info);
|
|
||||||
g_object_unref(file);
|
|
||||||
|
|
||||||
if (S_ISREG(mode) == 0) {
|
|
||||||
girara_info("%s is not a regular file. Skipping.", path);
|
girara_info("%s is not a regular file. Skipping.", path);
|
||||||
g_free(path);
|
g_free(path);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue