forked from enlightenment/efl
* 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:
parent
ddee121285
commit
b9d313774f
|
@ -39,6 +39,9 @@ ef_cb_efreet_data_home(void)
|
||||||
efreet_shutdown();
|
efreet_shutdown();
|
||||||
unsetenv("XDG_DATA_HOME");
|
unsetenv("XDG_DATA_HOME");
|
||||||
unsetenv("HOME");
|
unsetenv("HOME");
|
||||||
|
#ifdef _WIN32
|
||||||
|
unsetenv("USERPROFILE");
|
||||||
|
#endif
|
||||||
efreet_init();
|
efreet_init();
|
||||||
|
|
||||||
tmp = efreet_data_home_get();
|
tmp = efreet_data_home_get();
|
||||||
|
@ -88,6 +91,9 @@ ef_cb_efreet_config_home(void)
|
||||||
efreet_shutdown();
|
efreet_shutdown();
|
||||||
unsetenv("XDG_CONFIG_HOME");
|
unsetenv("XDG_CONFIG_HOME");
|
||||||
unsetenv("HOME");
|
unsetenv("HOME");
|
||||||
|
#ifdef _WIN32
|
||||||
|
unsetenv("USERPROFILE");
|
||||||
|
#endif
|
||||||
efreet_init();
|
efreet_init();
|
||||||
|
|
||||||
tmp = efreet_config_home_get();
|
tmp = efreet_config_home_get();
|
||||||
|
@ -137,6 +143,9 @@ ef_cb_efreet_cache_home(void)
|
||||||
efreet_shutdown();
|
efreet_shutdown();
|
||||||
unsetenv("XDG_CACHE_HOME");
|
unsetenv("XDG_CACHE_HOME");
|
||||||
unsetenv("HOME");
|
unsetenv("HOME");
|
||||||
|
#ifdef _WIN32
|
||||||
|
unsetenv("USERPROFILE");
|
||||||
|
#endif
|
||||||
efreet_init();
|
efreet_init();
|
||||||
|
|
||||||
tmp = efreet_cache_home_get();
|
tmp = efreet_cache_home_get();
|
||||||
|
|
|
@ -45,6 +45,9 @@ ef_cb_efreet_icon_theme(void)
|
||||||
|
|
||||||
efreet_shutdown();
|
efreet_shutdown();
|
||||||
unsetenv("HOME");
|
unsetenv("HOME");
|
||||||
|
#ifdef _WIN32
|
||||||
|
unsetenv("USERPROFILE");
|
||||||
|
#endif
|
||||||
efreet_init();
|
efreet_init();
|
||||||
|
|
||||||
tmp = efreet_icon_user_dir_get();
|
tmp = efreet_icon_user_dir_get();
|
||||||
|
|
|
@ -10,6 +10,12 @@
|
||||||
#include "Efreet.h"
|
#include "Efreet.h"
|
||||||
#include "efreet_private.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 *efreet_home_dir = NULL;
|
||||||
static const char *xdg_data_home = NULL;
|
static const char *xdg_data_home = NULL;
|
||||||
static const char *xdg_config_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;
|
if (efreet_home_dir) return efreet_home_dir;
|
||||||
|
|
||||||
efreet_home_dir = getenv("HOME");
|
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')
|
if (!efreet_home_dir || efreet_home_dir[0] == '\0')
|
||||||
efreet_home_dir = "/tmp";
|
efreet_home_dir = "/tmp";
|
||||||
|
|
||||||
|
@ -102,9 +112,19 @@ efreet_data_home_get(void)
|
||||||
EAPI Eina_List *
|
EAPI Eina_List *
|
||||||
efreet_data_dirs_get(void)
|
efreet_data_dirs_get(void)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
char buf[4096];
|
||||||
|
#endif
|
||||||
|
|
||||||
if (xdg_data_dirs) return xdg_data_dirs;
|
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",
|
xdg_data_dirs = efreet_dirs_get("XDG_DATA_DIRS",
|
||||||
PACKAGE_DATA_DIR ":/usr/share");
|
PACKAGE_DATA_DIR ":/usr/share");
|
||||||
|
#endif
|
||||||
return xdg_data_dirs;
|
return xdg_data_dirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +225,7 @@ efreet_dirs_get(const char *key, const char *fallback)
|
||||||
|
|
||||||
tmp = strdup(path);
|
tmp = strdup(path);
|
||||||
s = tmp;
|
s = tmp;
|
||||||
p = strchr(s, ':');
|
p = strchr(s, EFREET_PATH_SEP);
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
*p = '\0';
|
*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));
|
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(s));
|
||||||
|
|
||||||
s = ++p;
|
s = ++p;
|
||||||
p = strchr(s, ':');
|
p = strchr(s, EFREET_PATH_SEP);
|
||||||
}
|
}
|
||||||
if (!eina_list_search_unsorted(dirs, EINA_COMPARE_CB(strcmp), s))
|
if (!eina_list_search_unsorted(dirs, EINA_COMPARE_CB(strcmp), s))
|
||||||
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(s));
|
dirs = eina_list_append(dirs, (void *)eina_stringshare_add(s));
|
||||||
|
|
Loading…
Reference in New Issue