diff --git a/Makefile.common b/Makefile.common index b0db36e277..5122a53591 100644 --- a/Makefile.common +++ b/Makefile.common @@ -105,6 +105,7 @@ OBJ += frontend/frontend.o \ libretro-common/file/dir_list.o \ libretro-common/string/string_list.o \ libretro-common/string/stdstring.o \ + dir_list_special.o \ file_ops.o \ libretro-common/file//nbio/nbio_stdio.o \ libretro-common/file/file_path.o \ diff --git a/command_event.c b/command_event.c index dbe81d8918..22f4544344 100644 --- a/command_event.c +++ b/command_event.c @@ -22,9 +22,7 @@ #include "screenshot.h" #include "intl/intl.h" #include "retroarch.h" - -#include -#include +#include "dir_list_special.h" #include "input/input_remapping.h" @@ -1415,8 +1413,7 @@ bool event_command(enum event_command cmd) if (!*settings->video.shader_dir) return false; - global->shader_dir.list = dir_list_new(settings->video.shader_dir, - "cg|cgp|glsl|glslp", false); + global->shader_dir.list = dir_list_new_special(DIR_LIST_SHADERS); if (!global->shader_dir.list || global->shader_dir.list->size == 0) { diff --git a/dir_list_special.c b/dir_list_special.c new file mode 100644 index 0000000000..ce551da20a --- /dev/null +++ b/dir_list_special.c @@ -0,0 +1,42 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "dir_list_special.h" +#include "configuration.h" + +struct string_list *dir_list_new_special(enum dir_list_type type) +{ + const char *dir = NULL; + const char *exts = NULL; + bool include_dirs = false; + + settings_t *settings = config_get_ptr(); + + (void)settings; + + switch (type) + { + case DIR_LIST_SHADERS: + dir = settings->video.shader_dir; + exts = "cg|cgp|glsl|glslp"; + break; + case DIR_LIST_NONE: + default: + return NULL; + } + + return dir_list_new(dir, exts, include_dirs); +} diff --git a/dir_list_special.h b/dir_list_special.h new file mode 100644 index 0000000000..ab6d47c0eb --- /dev/null +++ b/dir_list_special.h @@ -0,0 +1,35 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef _DIR_LIST_SPECIAL_H +#define _DIR_LIST_SPECIAL_H + +#include + +#include +#include + +#include + +enum dir_list_type +{ + DIR_LIST_NONE = 0, + DIR_LIST_SHADERS, +}; + +struct string_list *dir_list_new_special(enum dir_list_type type); + +#endif diff --git a/griffin/griffin.c b/griffin/griffin.c index 490d829d3b..63bca3793d 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -560,6 +560,7 @@ FILE #include "../libretro-common/file/file_path.c" #include "../file_path_special.c" #include "../libretro-common/file/dir_list.c" +#include "../dir_list_special.c" #include "../libretro-common/string/string_list.c" #include "../libretro-common/string/stdstring.c" #include "../file_ops.c"