(database_info/task_database) Get rid of list_special dependencies

This commit is contained in:
twinaphex 2018-04-10 04:13:45 +02:00
parent 3016edce0a
commit 6f0fc2426d
7 changed files with 37 additions and 16 deletions

View File

@ -751,7 +751,8 @@ void core_info_get_name(const char *path, char *s, size_t len,
size_t i;
const char *path_basedir = !string_is_empty(path_info) ?
path_info : dir_cores;
struct string_list *contents = dir_list_new_special(dir_cores, DIR_LIST_CORES, NULL);
struct string_list *contents = dir_list_new_special(
dir_cores, DIR_LIST_CORES, NULL);
if (!contents)
return;

View File

@ -22,12 +22,13 @@
#include <retro_endianness.h>
#include <file/file_path.h>
#include <lists/string_list.h>
#include <lists/dir_list.h>
#include <string/stdstring.h>
#include "libretro-db/libretrodb.h"
#include "core_info.h"
#include "database_info.h"
#include "list_special.h"
#include "verbosity.h"
int database_info_build_query_enum(char *s, size_t len,
@ -367,16 +368,22 @@ static void dir_list_prioritize(struct string_list *list)
}
database_info_handle_t *database_info_dir_init(const char *dir,
enum database_type type, retro_task_t *task)
enum database_type type, retro_task_t *task,
bool show_hidden_files)
{
struct string_list *list = NULL;
database_info_handle_t *db = (database_info_handle_t*)
core_info_list_t *core_info_list = NULL;
struct string_list *list = NULL;
database_info_handle_t *db = (database_info_handle_t*)
calloc(1, sizeof(*db));
if (!db)
return NULL;
list = dir_list_new_special(dir, DIR_LIST_RECURSIVE, NULL);
core_info_get_list(&core_info_list);
list = dir_list_new(dir, core_info_list->all_ext,
false, show_hidden_files,
false, true);
if (!list)
{

View File

@ -126,7 +126,8 @@ database_info_list_t *database_info_list_new(const char *rdb_path,
void database_info_list_free(database_info_list_t *list);
database_info_handle_t *database_info_dir_init(const char *dir,
enum database_type type, retro_task_t *task);
enum database_type type, retro_task_t *task,
bool show_hidden_files);
database_info_handle_t *database_info_file_init(const char *path,
enum database_type type, retro_task_t *task);

View File

@ -983,7 +983,9 @@ static void content_add_to_playlist(const char *path)
task_push_dbscan(
settings->paths.directory_playlist,
settings->paths.path_content_database,
path, false, handle_dbscan_finished);
path, false,
settings->bools.show_hidden_files,
handle_dbscan_finished);
#endif
}

View File

@ -64,7 +64,9 @@ int action_scan_file(const char *path,
task_push_dbscan(
settings->paths.directory_playlist,
settings->paths.path_content_database,
fullpath, false, handle_dbscan_finished);
fullpath, false,
settings->bools.show_hidden_files,
handle_dbscan_finished);
return 0;
}
@ -90,7 +92,9 @@ int action_scan_directory(const char *path,
task_push_dbscan(
settings->paths.directory_playlist,
settings->paths.path_content_database,
fullpath, true, handle_dbscan_finished);
fullpath, true,
settings->bools.show_hidden_files,
handle_dbscan_finished);
return 0;
}

View File

@ -31,7 +31,6 @@
#include "../database_info.h"
#include "../file_path_special.h"
#include "../list_special.h"
#include "../msg_hash.h"
#include "../playlist.h"
#ifdef RARCH_INTERNAL
@ -61,6 +60,7 @@ typedef struct db_handle
{
bool is_directory;
bool scan_started;
bool show_hidden_files;
unsigned status;
char *playlist_directory;
char *content_database_path;
@ -1142,7 +1142,7 @@ static void task_database_handler(retro_task_t *task)
if (!string_is_empty(db->fullpath))
{
if (db->is_directory)
db->handle = database_info_dir_init(db->fullpath, DATABASE_TYPE_ITERATE, task);
db->handle = database_info_dir_init(db->fullpath, DATABASE_TYPE_ITERATE, task, db->show_hidden_files);
else
db->handle = database_info_file_init(db->fullpath, DATABASE_TYPE_ITERATE, task);
}
@ -1165,9 +1165,11 @@ static void task_database_handler(retro_task_t *task)
if (dbstate && !dbstate->list)
{
if (!string_is_empty(db->content_database_path))
dbstate->list = dir_list_new_special(
dbstate->list = dir_list_new(
db->content_database_path,
DIR_LIST_DATABASES, NULL);
"rdb", false,
db->show_hidden_files,
false, false);
/* If the scan path matches a database path exactly then
* save time by only processing that database. */
@ -1287,7 +1289,9 @@ bool task_push_dbscan(
const char *playlist_directory,
const char *content_database,
const char *fullpath,
bool directory, retro_task_callback_t cb)
bool directory,
bool show_hidden_files,
retro_task_callback_t cb)
{
retro_task_t *t = (retro_task_t*)calloc(1, sizeof(*t));
db_handle_t *db = (db_handle_t*)calloc(1, sizeof(db_handle_t));
@ -1300,6 +1304,7 @@ bool task_push_dbscan(
t->callback = cb;
t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN));
db->show_hidden_files = show_hidden_files;
db->is_directory = directory;
db->playlist_directory = NULL;
db->fullpath = strdup(fullpath);

View File

@ -133,7 +133,8 @@ bool task_push_dbscan(
const char *playlist_directory,
const char *content_database,
const char *fullpath,
bool directory, retro_task_callback_t cb);
bool directory, bool show_hidden_files,
retro_task_callback_t cb);
#endif
#ifdef HAVE_OVERLAY