(Filebrowser) Don't expose filebrowser_get_current_path function

This commit is contained in:
twinaphex 2013-04-12 10:33:55 +02:00
parent 54ec513e7e
commit 345a9c77e8
3 changed files with 9 additions and 7 deletions

View File

@ -1108,7 +1108,7 @@ static void browser_render(void *data)
#ifdef HAVE_MENU_PANEL
//check if this is the currently selected file
const char *current_pathname = filebrowser_get_current_path(b);
const char *current_pathname = b->current_path;
if (strcmp(current_pathname, b->current_dir.list->elems[i].data) == 0)
{
menu_panel->x = 0;
@ -1171,7 +1171,7 @@ static int select_file(uint8_t menu_type, uint64_t input)
ret = filebrowser_iterate(filebrowser, FILEBROWSER_ACTION_OK);
else
{
strlcpy(path, filebrowser_get_current_path(filebrowser), sizeof(path));
strlcpy(path, filebrowser->current_path, sizeof(path));
switch(menu_type)
{
@ -1308,7 +1308,7 @@ static int select_directory(uint8_t menu_type, uint64_t input)
{
if (is_dir)
{
strlcpy(path, filebrowser_get_current_path(filebrowser), sizeof(path));
strlcpy(path, filebrowser->current_path, sizeof(path));
switch(menu_type)
{
@ -2788,7 +2788,7 @@ static int select_rom(uint8_t menu_type, uint64_t input)
}
else
{
strlcpy(g_extern.fullpath, filebrowser_get_current_path(filebrowser), sizeof(g_extern.fullpath));
strlcpy(g_extern.fullpath, filebrowser->current_path, sizeof(g_extern.fullpath));
g_extern.lifecycle_mode_state |= (1ULL << MODE_LOAD_GAME);
}
}

View File

@ -27,7 +27,7 @@ static bool directory_parse(void *data, const char *path)
if(!list)
return false;
dir_list_sort(filebrowser->current_dir.list, true);
dir_list_sort(list, true);
filebrowser->current_dir.ptr = 0;
strlcpy(filebrowser->directory_path, path, sizeof(filebrowser->directory_path));
@ -62,7 +62,7 @@ void filebrowser_set_root_and_ext(void *data, const char *ext, const char *root_
filebrowser_iterate(filebrowser, FILEBROWSER_ACTION_RESET);
}
const char *filebrowser_get_current_path (void *data)
static inline const char *filebrowser_get_current_path (void *data)
{
filebrowser_t *filebrowser = (filebrowser_t*)data;
return filebrowser->current_dir.list->elems[filebrowser->current_dir.ptr].data;
@ -125,5 +125,7 @@ bool filebrowser_iterate(void *data, unsigned action)
break;
}
strlcpy(filebrowser->current_path, filebrowser_get_current_path(filebrowser), sizeof(filebrowser->current_path));
return ret;
}

View File

@ -26,6 +26,7 @@ typedef struct
struct string_list *list;
size_t ptr;
} current_dir;
char current_path[PATH_MAX];
char root_dir[PATH_MAX];
char extensions[PATH_MAX];
} filebrowser_t;
@ -45,7 +46,6 @@ typedef enum
FILEBROWSER_ACTION_NOOP
} filebrowser_action_t;
const char * filebrowser_get_current_path (void *data);
void filebrowser_set_root_and_ext(void *data, const char *ext, const char *root_dir);
void filebrowser_free(void *data);
bool filebrowser_iterate(void *data, unsigned action);