parent
84d381344a
commit
0a4938a4f2
|
@ -20,8 +20,9 @@ _config_home_get(void)
|
||||||
if (v) eina_strlcpy(path, v, sizeof(path));
|
if (v) eina_strlcpy(path, v, sizeof(path));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v = getenv("HOME");
|
char homepath[PATH_MAX];
|
||||||
if (v) snprintf(path, sizeof(path), "%s/.config", v);
|
if (homedir_get(homepath, sizeof(homepath)))
|
||||||
|
snprintf(path, sizeof(path), "%s/.config", homepath);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!v) v = getenv("TMP");
|
if (!v) v = getenv("TMP");
|
||||||
|
|
|
@ -58,21 +58,12 @@ _cwd_path_get(const Evas_Object *obj, const char *relpath)
|
||||||
static char *
|
static char *
|
||||||
_home_path_get(const Evas_Object *obj __UNUSED__, const char *relpath)
|
_home_path_get(const Evas_Object *obj __UNUSED__, const char *relpath)
|
||||||
{
|
{
|
||||||
char tmppath[PATH_MAX];
|
char tmppath[PATH_MAX], homepath[PATH_MAX];
|
||||||
const char *home = getenv("HOME");
|
|
||||||
if (!home)
|
|
||||||
{
|
|
||||||
uid_t uid = getuid();
|
|
||||||
struct passwd *pw = getpwuid(uid);
|
|
||||||
if (pw) home = pw->pw_dir;
|
|
||||||
}
|
|
||||||
if (!home)
|
|
||||||
{
|
|
||||||
ERR("Could not get $HOME");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
eina_str_join(tmppath, sizeof(tmppath), '/', home, relpath);
|
if (!homedir_get(homepath, sizeof(homepath)))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
eina_str_join(tmppath, sizeof(tmppath), '/', homepath, relpath);
|
||||||
return strdup(tmppath);
|
return strdup(tmppath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
#include <Edje.h>
|
#include <Edje.h>
|
||||||
|
|
||||||
|
@ -51,6 +53,24 @@ theme_auto_reload_enable(Evas_Object *edje)
|
||||||
(edje, "edje,change,file", "edje", theme_reload_cb, NULL);
|
(edje, "edje,change,file", "edje", theme_reload_cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
homedir_get(char *buf, size_t size)
|
||||||
|
{
|
||||||
|
const char *home = getenv("HOME");
|
||||||
|
if (!home)
|
||||||
|
{
|
||||||
|
uid_t uid = getuid();
|
||||||
|
struct passwd *pw = getpwuid(uid);
|
||||||
|
if (pw) home = pw->pw_dir;
|
||||||
|
}
|
||||||
|
if (!home)
|
||||||
|
{
|
||||||
|
ERR("Could not get $HOME");
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
return eina_strlcpy(buf, home, size) < size;
|
||||||
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
link_is_protocol(const char *str)
|
link_is_protocol(const char *str)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,8 @@ Eina_Bool theme_apply(Evas_Object *edje, const Config *config, const char *group
|
||||||
void theme_reload(Evas_Object *edje);
|
void theme_reload(Evas_Object *edje);
|
||||||
void theme_auto_reload_enable(Evas_Object *edje);
|
void theme_auto_reload_enable(Evas_Object *edje);
|
||||||
|
|
||||||
|
Eina_Bool homedir_get(char *buf, size_t size);
|
||||||
|
|
||||||
Eina_Bool link_is_protocol(const char *str);
|
Eina_Bool link_is_protocol(const char *str);
|
||||||
Eina_Bool link_is_url(const char *str);
|
Eina_Bool link_is_url(const char *str);
|
||||||
Eina_Bool link_is_email(const char *str);
|
Eina_Bool link_is_email(const char *str);
|
||||||
|
|
Loading…
Reference in New Issue