* Allow some tests to pass on Windows. Just for the fun

* More important, allow to manage correctly the icons with
   efreet on Windows. It works with Tango (and ewl, now)


SVN revision: 41130
This commit is contained in:
Vincent Torri 2009-06-20 16:18:17 +00:00
parent ddee121285
commit b9d313774f
3 changed files with 34 additions and 2 deletions

View File

@ -39,6 +39,9 @@ ef_cb_efreet_data_home(void)
efreet_shutdown();
unsetenv("XDG_DATA_HOME");
unsetenv("HOME");
#ifdef _WIN32
unsetenv("USERPROFILE");
#endif
efreet_init();
tmp = efreet_data_home_get();
@ -88,6 +91,9 @@ ef_cb_efreet_config_home(void)
efreet_shutdown();
unsetenv("XDG_CONFIG_HOME");
unsetenv("HOME");
#ifdef _WIN32
unsetenv("USERPROFILE");
#endif
efreet_init();
tmp = efreet_config_home_get();
@ -137,6 +143,9 @@ ef_cb_efreet_cache_home(void)
efreet_shutdown();
unsetenv("XDG_CACHE_HOME");
unsetenv("HOME");
#ifdef _WIN32
unsetenv("USERPROFILE");
#endif
efreet_init();
tmp = efreet_cache_home_get();

View File

@ -45,6 +45,9 @@ ef_cb_efreet_icon_theme(void)
efreet_shutdown();
unsetenv("HOME");
#ifdef _WIN32
unsetenv("USERPROFILE");
#endif
efreet_init();
tmp = efreet_icon_user_dir_get();

View File

@ -10,6 +10,12 @@
#include "Efreet.h"
#include "efreet_private.h"
#ifdef _WIN32
# define EFREET_PATH_SEP ';'
#else
# define EFREET_PATH_SEP ':'
#endif
static const char *efreet_home_dir = NULL;
static const char *xdg_data_home = NULL;
static const char *xdg_config_home = NULL;
@ -70,6 +76,10 @@ efreet_home_dir_get(void)
if (efreet_home_dir) return efreet_home_dir;
efreet_home_dir = getenv("HOME");
#ifdef _WIN32
if (!efreet_home_dir || efreet_home_dir[0] == '\0')
efreet_home_dir = getenv("USERPROFILE");
#endif
if (!efreet_home_dir || efreet_home_dir[0] == '\0')
efreet_home_dir = "/tmp";
@ -102,9 +112,19 @@ efreet_data_home_get(void)
EAPI Eina_List *
efreet_data_dirs_get(void)
{
#ifdef _WIN32
char buf[4096];
#endif
if (xdg_data_dirs) return xdg_data_dirs;
#ifdef _WIN32
snprintf(buf, 4096, "%s\\Efl;" PACKAGE_DATA_DIR ";/usr/share", getenv("APPDATA"));
xdg_data_dirs = efreet_dirs_get("XDG_DATA_DIRS", buf);
#else
xdg_data_dirs = efreet_dirs_get("XDG_DATA_DIRS",
PACKAGE_DATA_DIR ":/usr/share");
#endif
return xdg_data_dirs;
}
@ -205,7 +225,7 @@ efreet_dirs_get(const char *key, const char *fallback)
tmp = strdup(path);
s = tmp;
p = strchr(s, ':');
p = strchr(s, EFREET_PATH_SEP);
while (p)
{
*p = '\0';
@ -213,7 +233,7 @@ efreet_dirs_get(const char *key, const char *fallback)
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(s));
s = ++p;
p = strchr(s, ':');
p = strchr(s, EFREET_PATH_SEP);
}
if (!eina_list_search_unsorted(dirs, EINA_COMPARE_CB(strcmp), s))
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(s));