forked from enlightenment/efl
Efreet: We don't add non-existing dirs to lists
SVN revision: 58608
This commit is contained in:
parent
4c7b75cbf4
commit
979f1c7e4b
|
@ -1,4 +1,5 @@
|
||||||
#include "Efreet.h"
|
#include "Efreet.h"
|
||||||
|
#include <Ecore_File.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -163,7 +164,9 @@ int
|
||||||
ef_cb_efreet_data_dirs(void)
|
ef_cb_efreet_data_dirs(void)
|
||||||
{
|
{
|
||||||
Eina_List *tmp, *l;
|
Eina_List *tmp, *l;
|
||||||
int ret = 1, i;
|
int ret = 1;
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int ok;
|
||||||
char dirs[128], *val;
|
char dirs[128], *val;
|
||||||
char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
|
char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
|
||||||
char *def_vals[] = {PACKAGE_DATA_DIR, "/usr/share", "/usr/local/share", NULL};
|
char *def_vals[] = {PACKAGE_DATA_DIR, "/usr/share", "/usr/local/share", NULL};
|
||||||
|
@ -180,25 +183,35 @@ ef_cb_efreet_data_dirs(void)
|
||||||
efreet_init();
|
efreet_init();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
ok = 0;
|
||||||
tmp = efreet_data_dirs_get();
|
tmp = efreet_data_dirs_get();
|
||||||
EINA_LIST_FOREACH(tmp, l, val)
|
for (i = 0; vals[i]; i++)
|
||||||
{
|
{
|
||||||
if (!vals[i])
|
char *found;
|
||||||
{
|
|
||||||
printf("efreet_data_dirs_get() returned more values then it "
|
|
||||||
"should have given %s as input\n", dirs);
|
|
||||||
ret = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(val, vals[i]))
|
found = eina_list_search_unsorted(tmp, EINA_COMPARE_CB(strcmp), vals[i]);
|
||||||
|
if (!ecore_file_exists(vals[i]) && found)
|
||||||
{
|
{
|
||||||
printf("efreet_data_dirs_get() returned incorrect value (%s) when "
|
printf("efreet_data_dirs_get() includes non-existing dir (%s) when "
|
||||||
"%s set\n", val, dirs);
|
"%s set\n", vals[i], dirs);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ecore_file_exists(vals[i]) && !found)
|
||||||
i++;
|
{
|
||||||
|
printf("efreet_data_dirs_get() is missing dir (%s) when "
|
||||||
|
"%s set\n", vals[i], dirs);
|
||||||
|
ret = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ecore_file_exists(vals[i]) && found)
|
||||||
|
ok++;
|
||||||
|
}
|
||||||
|
if (eina_list_count(tmp) != ok)
|
||||||
|
{
|
||||||
|
printf("efreet_data_dirs_get() returned more values then it "
|
||||||
|
"should have given %s as input\n", dirs);
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
efreet_shutdown();
|
efreet_shutdown();
|
||||||
|
@ -239,7 +252,9 @@ int
|
||||||
ef_cb_efreet_config_dirs(void)
|
ef_cb_efreet_config_dirs(void)
|
||||||
{
|
{
|
||||||
Eina_List *tmp, *l;
|
Eina_List *tmp, *l;
|
||||||
int ret = 1, i;
|
int ret = 1;
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int ok;
|
||||||
char dirs[128], *val;
|
char dirs[128], *val;
|
||||||
char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
|
char *vals[] = {"/var/tmp/a", "/tmp/b", "/usr/local/share", "/etc", NULL};
|
||||||
char *def_vals[] = {"/etc/xdg", NULL};
|
char *def_vals[] = {"/etc/xdg", NULL};
|
||||||
|
@ -257,25 +272,35 @@ ef_cb_efreet_config_dirs(void)
|
||||||
efreet_init();
|
efreet_init();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
ok = 0;
|
||||||
tmp = efreet_config_dirs_get();
|
tmp = efreet_config_dirs_get();
|
||||||
EINA_LIST_FOREACH(tmp, l, val)
|
for (i = 0; vals[i]; i++)
|
||||||
{
|
{
|
||||||
if (!vals[i])
|
char *found;
|
||||||
{
|
|
||||||
printf("efreet_config_dirs_get() returned more values then it "
|
|
||||||
"should have given %s as input\n", dirs);
|
|
||||||
ret = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(val, vals[i]))
|
found = eina_list_search_unsorted(tmp, EINA_COMPARE_CB(strcmp), vals[i]);
|
||||||
|
if (!ecore_file_exists(vals[i]) && found)
|
||||||
{
|
{
|
||||||
printf("efreet_config_dirs_get() returned incorrect value (%s) when "
|
printf("efreet_data_dirs_get() includes non-existing dir (%s) when "
|
||||||
"%s set\n", val, dirs);
|
"%s set\n", vals[i], dirs);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ecore_file_exists(vals[i]) && !found)
|
||||||
i++;
|
{
|
||||||
|
printf("efreet_data_dirs_get() is missing dir (%s) when "
|
||||||
|
"%s set\n", vals[i], dirs);
|
||||||
|
ret = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ecore_file_exists(vals[i]) && found)
|
||||||
|
ok++;
|
||||||
|
}
|
||||||
|
if (eina_list_count(tmp) != ok)
|
||||||
|
{
|
||||||
|
printf("efreet_data_dirs_get() returned more values then it "
|
||||||
|
"should have given %s as input\n", dirs);
|
||||||
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
efreet_shutdown();
|
efreet_shutdown();
|
||||||
|
|
Loading…
Reference in New Issue