1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-22 18:06:40 +00:00

Ignore hidden files when using wildcards.

This commit is contained in:
Steven Mattera 2018-11-08 19:09:14 -05:00
parent ec1bb508b3
commit 14cdcc1497
5 changed files with 7 additions and 7 deletions

View file

@ -45,7 +45,7 @@ int ini_parse(link_t *dst, char *ini_path, bool is_dir)
if (is_dir)
{
filelist = dirlist(filename, "*.ini");
filelist = dirlist(filename, "*.ini", false);
if (!filelist)
{
free(filename);

View file

@ -376,7 +376,7 @@ static int _config_kip1(launch_ctxt_t *ctxt, const char *value)
u32 dirlen = 0;
dir[strlen(dir) - 2] = 0;
char *filelist = dirlist(dir, "*.kip*");
char *filelist = dirlist(dir, "*.kip*", false);
memcpy(dir + strlen(dir), "/", 2);
dirlen = strlen(dir);

View file

@ -1985,7 +1985,7 @@ void launch_tools(u8 type)
else
memcpy(dir, "bootloader/libtools", 20);
filelist = dirlist(dir, NULL);
filelist = dirlist(dir, NULL, false);
u32 i = 0;

View file

@ -21,7 +21,7 @@
#include "../mem/heap.h"
#include "../utils/types.h"
char *dirlist(const char *directory, const char *pattern)
char *dirlist(const char *directory, const char *pattern, bool includeHiddenFiles)
{
u8 max_entries = 61;
@ -40,7 +40,7 @@ char *dirlist(const char *directory, const char *pattern)
res = f_readdir(&dir, &fno);
if (res || !fno.fname[0])
break;
if (!(fno.fattrib & AM_DIR))
if (!(fno.fattrib & AM_DIR) && (fno.fname[0] != '.') && (includeHiddenFiles || !(fno.fattrib & AM_HID)))
{
memcpy(dir_entries + (k * 256), fno.fname, strlen(fno.fname) + 1);
k++;
@ -54,7 +54,7 @@ char *dirlist(const char *directory, const char *pattern)
{
do
{
if (!(fno.fattrib & AM_DIR))
if (!(fno.fattrib & AM_DIR) && (fno.fname[0] != '.') && (includeHiddenFiles || !(fno.fattrib & AM_HID)))
{
memcpy(dir_entries + (k * 256), fno.fname, strlen(fno.fname) + 1);
k++;

View file

@ -16,4 +16,4 @@
#include "../utils/types.h"
char *dirlist(const char *directory, const char *pattern);
char *dirlist(const char *directory, const char *pattern, bool includeHiddenFiles);