forked from enlightenment/efl
Function to check whether a path resides inside a default directory.
SVN revision: 28279
This commit is contained in:
parent
0c13e147a5
commit
b928ccc30c
|
@ -32,6 +32,7 @@ extern "C" {
|
|||
#include "efreet_icon.h"
|
||||
#include "efreet_desktop.h"
|
||||
#include "efreet_menu.h"
|
||||
#include "efreet_utils.h"
|
||||
|
||||
int efreet_init(void);
|
||||
int efreet_shutdown(void);
|
||||
|
|
|
@ -14,7 +14,8 @@ Efreet.h \
|
|||
efreet_base.h \
|
||||
efreet_desktop.h \
|
||||
efreet_icon.h \
|
||||
efreet_menu.h
|
||||
efreet_menu.h \
|
||||
efreet_utils.h
|
||||
|
||||
EFREETSOURCES = \
|
||||
efreet.c \
|
||||
|
@ -24,6 +25,7 @@ efreet_xml.c \
|
|||
efreet_ini.c \
|
||||
efreet_desktop.c \
|
||||
efreet_menu.c \
|
||||
efreet_utils.c \
|
||||
$(EFREETHEADERS)
|
||||
|
||||
libefreet_la_SOURCES = \
|
||||
|
|
|
@ -220,9 +220,6 @@ static Ecore_Hash *efreet_menu_move_cbs = NULL;
|
|||
static Ecore_Hash *efreet_menu_layout_cbs = NULL;
|
||||
|
||||
static const char *efreet_menu_prefix_get(void);
|
||||
static Ecore_List *efreet_default_dirs_get(const char *user_dir,
|
||||
Ecore_List *system_dirs,
|
||||
const char *suffix);
|
||||
|
||||
static Efreet_Menu_Internal *efreet_menu_by_name_find(Efreet_Menu_Internal *internal,
|
||||
const char *name,
|
||||
|
@ -836,6 +833,38 @@ efreet_menu_dump(Efreet_Menu *menu, const char *indent)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user_dir: The user directory to work with
|
||||
* @param system_dirs: The system directories to work with
|
||||
* @param suffix: The path suffix to add
|
||||
* @return Returns the list of directories
|
||||
* @brief Creates the list of directories based on the user
|
||||
* dir, system dirs and given suffix.
|
||||
*/
|
||||
Ecore_List *
|
||||
efreet_default_dirs_get(const char *user_dir, Ecore_List *system_dirs,
|
||||
const char *suffix)
|
||||
{
|
||||
const char *xdg_dir;
|
||||
char dir[PATH_MAX];
|
||||
Ecore_List *list;
|
||||
|
||||
list = ecore_list_new();
|
||||
ecore_list_set_free_cb(list, ECORE_FREE_CB(free));
|
||||
|
||||
snprintf(dir, sizeof(dir), "%s/%s", user_dir, suffix);
|
||||
ecore_list_append(list, strdup(dir));
|
||||
|
||||
ecore_list_goto_first(system_dirs);
|
||||
while ((xdg_dir = ecore_list_next(system_dirs)))
|
||||
{
|
||||
snprintf(dir, sizeof(dir), "%s/%s", xdg_dir, suffix);
|
||||
ecore_list_append(list, strdup(dir));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return Returns a new Efreet_Menu_Internal struct
|
||||
|
@ -910,39 +939,6 @@ efreet_menu_prefix_get(void)
|
|||
return efreet_menu_prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param user_dir: The user directory to work with
|
||||
* @param system_dirs: The system directories to work with
|
||||
* @param suffix: The path suffix to add
|
||||
* @return Returns the list of directories
|
||||
* @brief Creates the list of directories based on the user
|
||||
* dir, system dirs and given suffix.
|
||||
*/
|
||||
static Ecore_List *
|
||||
efreet_default_dirs_get(const char *user_dir, Ecore_List *system_dirs,
|
||||
const char *suffix)
|
||||
{
|
||||
const char *xdg_dir;
|
||||
char dir[PATH_MAX];
|
||||
Ecore_List *list;
|
||||
|
||||
list = ecore_list_new();
|
||||
ecore_list_set_free_cb(list, ECORE_FREE_CB(free));
|
||||
|
||||
snprintf(dir, sizeof(dir), "%s/%s", user_dir, suffix);
|
||||
ecore_list_append(list, strdup(dir));
|
||||
|
||||
ecore_list_goto_first(system_dirs);
|
||||
while ((xdg_dir = ecore_list_next(system_dirs)))
|
||||
{
|
||||
snprintf(dir, sizeof(dir), "%s/%s", xdg_dir, suffix);
|
||||
ecore_list_append(list, strdup(dir));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param menu: The menu to populate
|
||||
|
|
|
@ -160,6 +160,9 @@ void efreet_icon_shutdown(void);
|
|||
|
||||
int efreet_menu_init(void);
|
||||
void efreet_menu_shutdown(void);
|
||||
Ecore_List *efreet_default_dirs_get(const char *user_dir,
|
||||
Ecore_List *system_dirs,
|
||||
const char *suffix);
|
||||
|
||||
int efreet_ini_init(void);
|
||||
int efreet_ini_shutdown(void);
|
||||
|
|
Loading…
Reference in New Issue