summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-03-27 15:42:11 -0300
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-03-29 12:44:19 -0300
commita4be1e479c2c329e99d693d4921e1e39c66bc1a5 (patch)
treee418e5c3e48b68988d14553ed2ceeb47632363de
parentfa0e2865a1a53cd05298b8368fa9abdb7c83bff8 (diff)
downloadefl-a4be1e479c2c329e99d693d4921e1e39c66bc1a5.tar.gz
ecore_con_local_path_new(): implemented for Windows
-rw-r--r--src/lib/ecore_con/ecore_con_local.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c
index fa909c8f07..2e83774ec1 100644
--- a/src/lib/ecore_con/ecore_con_local.c
+++ b/src/lib/ecore_con/ecore_con_local.c
@@ -26,6 +26,7 @@
#include "Ecore_Con.h"
#include "ecore_con_private.h"
+#ifndef _WIN32
static const char *
_ecore_con_local_path_get(void)
{
@@ -39,10 +40,42 @@ _ecore_con_local_path_get(void)
if (!homedir) homedir = (char *)eina_environment_tmp_get();
return homedir;
}
+#endif
EAPI char *
ecore_con_local_path_new(Eina_Bool is_system, const char *name, int port)
{
+#if _WIN32
+ char buf[256 - sizeof(PIPE_NS)] = "";
+
+ /* note: using '!' instead of '|' since at least on wine '|' causes
+ * ERROR_INVALID_NAME
+ */
+
+ if (!is_system)
+ {
+ TCHAR user[sizeof(buf) - sizeof("ecore!u!n!1")] = "unknown";
+ DWORD userlen = sizeof(user);
+ if (!GetUserName(user, &userlen))
+ {
+ char *msg = _efl_net_windows_error_msg_get(GetLastError());
+ ERR("GetUserName(%p, %lu): %s", user, userlen, msg);
+ free(msg);
+ }
+ if (port < 0)
+ snprintf(buf, sizeof(buf), "ecore!%s!%s", user, name);
+ else
+ snprintf(buf, sizeof(buf), "ecore!%s!%s!%d", user, name, port);
+ }
+ else
+ {
+ if (port < 0)
+ snprintf(buf, sizeof(buf), "ecore_service!%s", name);
+ else
+ snprintf(buf, sizeof(buf), "ecore_service!%s!%d", name, port);
+ }
+ return strdup(buf);
+#else
char buf[4096];
const char *homedir;
@@ -99,6 +132,7 @@ ecore_con_local_path_new(Eina_Bool is_system, const char *name, int port)
return strdup(buf);
}
}
+#endif
}
void