Create dir_list_special.c

This commit is contained in:
twinaphex 2015-05-24 04:19:32 +02:00
parent 5e9a3631c5
commit 37a7749a73
5 changed files with 81 additions and 5 deletions

View File

@ -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 \

View File

@ -22,9 +22,7 @@
#include "screenshot.h"
#include "intl/intl.h"
#include "retroarch.h"
#include <file/file_path.h>
#include <file/dir_list.h>
#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)
{

42
dir_list_special.c Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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);
}

35
dir_list_special.h Normal file
View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef _DIR_LIST_SPECIAL_H
#define _DIR_LIST_SPECIAL_H
#include <stdint.h>
#include <file/file_path.h>
#include <file/dir_list.h>
#include <string/string_list.h>
enum dir_list_type
{
DIR_LIST_NONE = 0,
DIR_LIST_SHADERS,
};
struct string_list *dir_list_new_special(enum dir_list_type type);
#endif

View File

@ -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"