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)
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 @@
26#include "Ecore_Con.h" 26#include "Ecore_Con.h"
27#include "ecore_con_private.h" 27#include "ecore_con_private.h"
28 28
29#ifndef _WIN32
29static const char * 30static const char *
30_ecore_con_local_path_get(void) 31_ecore_con_local_path_get(void)
31{ 32{
@@ -39,10 +40,42 @@ _ecore_con_local_path_get(void)
39 if (!homedir) homedir = (char *)eina_environment_tmp_get(); 40 if (!homedir) homedir = (char *)eina_environment_tmp_get();
40 return homedir; 41 return homedir;
41} 42}
43#endif
42 44
43EAPI char * 45EAPI char *
44ecore_con_local_path_new(Eina_Bool is_system, const char *name, int port) 46ecore_con_local_path_new(Eina_Bool is_system, const char *name, int port)
45{ 47{
48#if _WIN32
49 char buf[256 - sizeof(PIPE_NS)] = "";
50
51 /* note: using '!' instead of '|' since at least on wine '|' causes
52 * ERROR_INVALID_NAME
53 */
54
55 if (!is_system)
56 {
57 TCHAR user[sizeof(buf) - sizeof("ecore!u!n!1")] = "unknown";
58 DWORD userlen = sizeof(user);
59 if (!GetUserName(user, &userlen))
60 {
61 char *msg = _efl_net_windows_error_msg_get(GetLastError());
62 ERR("GetUserName(%p, %lu): %s", user, userlen, msg);
63 free(msg);
64 }
65 if (port < 0)
66 snprintf(buf, sizeof(buf), "ecore!%s!%s", user, name);
67 else
68 snprintf(buf, sizeof(buf), "ecore!%s!%s!%d", user, name, port);
69 }
70 else
71 {
72 if (port < 0)
73 snprintf(buf, sizeof(buf), "ecore_service!%s", name);
74 else
75 snprintf(buf, sizeof(buf), "ecore_service!%s!%d", name, port);
76 }
77 return strdup(buf);
78#else
46 char buf[4096]; 79 char buf[4096];
47 const char *homedir; 80 const char *homedir;
48 81
@@ -99,6 +132,7 @@ ecore_con_local_path_new(Eina_Bool is_system, const char *name, int port)
99 return strdup(buf); 132 return strdup(buf);
100 } 133 }
101 } 134 }
135#endif
102} 136}
103 137
104void 138void