2005-02-07 05:51:09 -08:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
2004-11-24 19:37:45 -08:00
|
|
|
#include "e.h"
|
|
|
|
|
|
|
|
/* externally accessible functions */
|
2006-09-22 12:55:11 -07:00
|
|
|
EAPI const char *
|
2004-11-24 19:37:45 -08:00
|
|
|
e_user_homedir_get(void)
|
|
|
|
{
|
|
|
|
char *homedir;
|
2006-07-15 09:29:14 -07:00
|
|
|
int len;
|
2004-11-24 19:37:45 -08:00
|
|
|
|
|
|
|
homedir = getenv("HOME");
|
2006-09-22 12:55:11 -07:00
|
|
|
if (!homedir) return "/tmp";
|
2006-07-15 09:29:14 -07:00
|
|
|
len = strlen(homedir);
|
|
|
|
while ((len > 1) && (homedir[len - 1] == '/'))
|
|
|
|
{
|
|
|
|
homedir[len - 1] = 0;
|
|
|
|
len--;
|
|
|
|
}
|
2006-09-22 12:55:11 -07:00
|
|
|
return homedir;
|
2004-11-24 19:37:45 -08:00
|
|
|
}
|
2007-04-12 17:49:24 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the directory where user .desktop files should be stored.
|
|
|
|
* If the directory does not exist, it will be created. If it cannot be
|
|
|
|
* created, a dialog will be displayed an NULL will be returned
|
|
|
|
*/
|
|
|
|
EAPI const char *
|
|
|
|
e_user_desktop_dir_get(void)
|
|
|
|
{
|
|
|
|
static char dir[PATH_MAX] = "";
|
|
|
|
if (!dir[0])
|
|
|
|
snprintf(dir, sizeof(dir), "%s/applications", efreet_data_home_get());
|
|
|
|
|
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the directory where user .icon files should be stored.
|
|
|
|
* If the directory does not exist, it will be created. If it cannot be
|
|
|
|
* created, a dialog will be displayed an NULL will be returned
|
|
|
|
*/
|
|
|
|
EAPI const char *
|
|
|
|
e_user_icon_dir_get(void)
|
|
|
|
{
|
|
|
|
static char dir[PATH_MAX] = "";
|
|
|
|
if (!dir[0])
|
|
|
|
snprintf(dir, sizeof(dir), "%s/icons", efreet_data_home_get());
|
|
|
|
|
|
|
|
return dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
|