add api and lets test it - i'll document it later, but need to test

first.



SVN revision: 83867
This commit is contained in:
Carsten Haitzler 2013-02-13 11:35:46 +00:00
parent 5fa5f1430b
commit 179fd31b77
3 changed files with 61 additions and 4 deletions

View File

@ -1244,6 +1244,20 @@ typedef void (*Evas_Async_Events_Put_Cb)(void *target, Evas_Callback_Type t
* Functions that affect Evas as a whole.
*/
/**
* Get the path for the cserve binary to execute
*
* There is little need for anyone except a desktop nevironment to call this.
* This can be called before evas_init() has been called. It will try and find
* the full path to the to the cserve binary to run to provide cserve image
* and font caching services for evas.
*
* @return NULL if error, or a string with the full path to the cserve binary.
*
* @since 1.8
*/
EAPI const char *evas_cserve_path_get(void);
/**
* Initialize Evas
*

View File

@ -106,11 +106,11 @@ _server_connect(void)
remote.sun_family = AF_UNIX;
_socket_path_set(remote.sun_path);
len = strlen(remote.sun_path) + sizeof(remote.sun_family);
if (connect(s, (struct sockaddr *)&remote, len) == -1)
for (;;)
{
ERR("connect");
close(s);
return EINA_FALSE;
if (connect(s, (struct sockaddr *)&remote, len) != -1) break;
ERR("cserve connect failed. retrying.");
usleep(1000);
}
fcntl(s, F_SETFL, O_NONBLOCK);

View File

@ -615,3 +615,46 @@ _evas_module_libdir_get(void)
if (!pfx) return NULL;
return eina_prefix_lib_get(pfx);
}
EAPI const char *
evas_cserve_path_get(void)
{
static char buf[PATH_MAX];
const char *lib;
Eina_Bool shutdown = EINA_FALSE;
if (!pfx)
{
shutdown = EINA_TRUE;
eina_init();
pfx = eina_prefix_new
(NULL, _evas_module_libdir_get, "EVAS", "evas", "checkme",
PACKAGE_BIN_DIR, PACKAGE_LIB_DIR,
PACKAGE_DATA_DIR, PACKAGE_DATA_DIR);
if (!pfx)
{
eina_shutdown();
return NULL;
}
}
lib = eina_prefix_lib_get(pfx);
if (!lib)
{
if (shutdown)
{
eina_prefix_free(pfx);
pfx = NULL;
eina_shutdown();
}
return NULL;
}
snprintf(buf, sizeof(buf), "%s/evas/cserve2/bin/%s/evas_cserve2",
lib, MODULE_ARCH);
if (shutdown)
{
eina_prefix_free(pfx);
pfx = NULL;
eina_shutdown();
}
return buf;
}