#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <libgen.h>
#include "xdgmime.h"
#include "xasprintf.h"
Go to the source code of this file.
◆ PATH_SEPARATOR
#define PATH_SEPARATOR "/" |
◆ XFILEPICKER_H_
◆ fp_free()
fp_free - release all memory used by the filepicker
- Parameters
-
*filepicker | - pointer to the struct to be released |
- Returns
- void
Definition at line 176 of file xfilepicker.c.
177 fp_clear_filebuffer(filepicker);
178 fp_clear_dirbuffer(filepicker);
180 free(filepicker->
path);
◆ fp_get_files()
int fp_get_files |
( |
FilePicker * |
filepicker, |
|
|
char * |
path, |
|
|
int |
get_dirs |
|
) |
| |
fp_get_files - fill file_names and dir_names with the results from readdir path
- Parameters
-
*filepicker | - pointer to the struct holding the list pointers |
*path | - the path to read from |
get_dirs | - 0 = only read files 1 = refill the directory buffer as well |
- Returns
- int - return the position of the given path in the directory list
Definition at line 131 of file xfilepicker.c.
133 fp_clear_filebuffer(filepicker);
137 if((dirp = opendir(path)) == NULL) {
144 fp_clear_dirbuffer(filepicker);
145 ret = fp_prefill_dirbuffer(filepicker, path);
148 while ((dp = readdir(dirp)) != NULL) {
150 if(dp-> d_type != DT_DIR && strlen(dp->d_name)!=0 && dp->d_type != DT_UNKNOWN
151 && strcmp(dp->d_name,
"..")!=0 && fp_show_hidden_files(filepicker, dp->d_name) &&
152 fp_show_filter_files(filepicker, dp->d_name)) {
160 }
else if(get_dirs && dp -> d_type == DT_DIR && strlen(dp->d_name)!=0
161 && strcmp(dp->d_name,
"..")!=0 && fp_show_hidden_files(filepicker, dp->d_name)) {
172 fp_sort_buffers(filepicker, get_dirs);
◆ fp_init()
void fp_init |
( |
FilePicker * |
filepicker, |
|
|
const char * |
path |
|
) |
| |