Update Spanish translation
[evolution.git] / win32 / patches / dbus.patch
blob6d1bee36783cd31a1f66ff9a43463cf11774f8b9
1 diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' dbus-1.8.0.old/dbus/Makefile.am dbus-1.8.0/dbus/Makefile.am
2 --- dbus-1.8.0.old/dbus/Makefile.am 2014-09-05 16:09:18 +0000
3 +++ dbus-1.8.0/dbus/Makefile.am 2014-09-05 16:09:40 +0000
4 @@ -304,8 +304,8 @@ if DBUS_WIN
5 # this code is used, we don't actually need libstdc++.
6 noinst_LTLIBRARIES += libdbus-init-win.la
7 libdbus_init_win_la_SOURCES = dbus-init-win.cpp
8 -libdbus_1_la_LIBADD += libdbus-init-win.la
9 -libdbus_internal_la_LIBADD += libdbus-init-win.la
10 +libdbus_1_la_LIBADD += libdbus-init-win.la -lole32
11 +libdbus_internal_la_LIBADD += libdbus-init-win.la -lole32
12 endif
14 noinst_PROGRAMS =
15 diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' dbus-1.8.0.old/dbus/dbus-sysdeps-util-win.c dbus-1.8.0/dbus/dbus-sysdeps-util-win.c
16 --- dbus-1.8.0.old/dbus/dbus-sysdeps-util-win.c 2014-09-05 16:09:18 +0000
17 +++ dbus-1.8.0/dbus/dbus-sysdeps-util-win.c 2014-09-05 16:09:28 +0000
18 @@ -1555,13 +1555,12 @@ _dbus_replace_install_prefix (const char
19 if ((!_dbus_get_install_root(runtime_prefix, len) ||
20 strncmp (configure_time_path, DBUS_PREFIX "/",
21 strlen (DBUS_PREFIX) + 1))) {
22 - strcat (retval, configure_time_path);
23 - return retval;
24 + strcpy (retval, configure_time_path);
25 + } else {
26 + strcpy (retval, runtime_prefix);
27 + strcat (retval, configure_time_path + strlen (DBUS_PREFIX) + 1);
30 - strcpy (retval, runtime_prefix);
31 - strcat (retval, configure_time_path + strlen (DBUS_PREFIX) + 1);
33 /* Somehow, in some situations, backslashes get collapsed in the string.
34 * Since windows C library accepts both forward and backslashes as
35 * path separators, convert all backslashes to forward slashes.
36 diff -upr -x .deps -x .libs -x '*.la' -x '*.lo' dbus-1.8.0.old/dbus/dbus-sysdeps-win.c dbus-1.8.0/dbus/dbus-sysdeps-win.c
37 --- dbus-1.8.0.old/dbus/dbus-sysdeps-win.c 2014-09-05 16:09:18 +0000
38 +++ dbus-1.8.0/dbus/dbus-sysdeps-win.c 2014-09-05 16:09:40 +0000
39 @@ -55,6 +55,7 @@
40 #include <ws2tcpip.h>
41 #include <wincrypt.h>
42 #include <iphlpapi.h>
43 +#include <shlobj.h>
45 /* Declarations missing in mingw's and windows sdk 7.0 headers */
46 extern BOOL WINAPI ConvertStringSidToSidA (LPCSTR StringSid, PSID *Sid);
47 @@ -3379,6 +3380,139 @@ _dbus_lookup_session_address (dbus_bool_
48 return TRUE;
51 +static char *
52 +get_special_folder (int csidl)
54 + char path[MAX_PATH+1];
55 + HRESULT hr;
56 + LPITEMIDLIST pidl = NULL;
57 + BOOL b;
58 + char *retval = NULL;
60 + hr = SHGetSpecialFolderLocation (NULL, csidl, &pidl);
61 + if (hr == S_OK)
62 + {
63 + b = SHGetPathFromIDListA (pidl, path);
64 + if (b)
65 + retval = strdup (path);
66 + CoTaskMemFree (pidl);
67 + }
68 + return retval;
71 +static char *
72 +get_windows_directory_root (void)
74 + char windowsdir[MAX_PATH];
76 + if (GetWindowsDirectory (windowsdir, MAX_PATH))
77 + {
78 + /* Usually X:\Windows, but in terminal server environments
79 + * might be an UNC path, AFAIK.
80 + */
81 + int len;
83 + if (!*windowsdir)
84 + return strdup("C:\\");
86 + len = strlen(windowsdir);
87 + if (len < MAX_PATH - 1 && windowsdir[len - 1] != '\\' && windowsdir[len - 1] != '/') {
88 + char sep[2] = {0, 0}, *p;
90 + for (p = windowsdir; *p && !*sep; p++) {
91 + if (*p == '/' || *p == '\\') {
92 + sep[0] = *p;
93 + break;
94 + }
95 + }
97 + strcat(windowsdir, sep);
98 + }
99 + return strdup(windowsdir);
101 + else
102 + return strdup("C:\\");
105 +static dbus_bool_t
106 +_dbus_set_user_home (DBusString *homedir)
108 + const char *env;
109 + char *tmp = NULL;
111 + env = _dbus_getenv("HOME");
113 + /* Only believe HOME if it is an absolute path and exists.
115 + * We only do this check on Windows for a couple of reasons.
116 + * Historically, we only did it there because we used to ignore $HOME
117 + * on UNIX. There are concerns about enabling it now on UNIX because
118 + * of things like autofs. In short, if the user has a bogus value in
119 + * $HOME then they get what they pay for...
120 + */
121 + if (env)
123 + /* In case HOME is Unix-style (it happens), convert it to
124 + * Windows style.
125 + */
126 + char *p;
127 + tmp = strdup(env);
128 + while ((p = strchr(tmp, '/')) != NULL) {
129 + *p = '\\';
132 + if (!((tmp[0] == '\\' || (((tmp[0] >= 'a' && tmp[0] <= 'z') || (tmp[0] >= 'A' && tmp[0] <= 'Z')) && tmp[1] == ':')) &&
133 + GetFileAttributesA (tmp) != INVALID_FILE_ATTRIBUTES &&
134 + (GetFileAttributesA (tmp) & FILE_ATTRIBUTE_DIRECTORY) != 0))
136 + env = NULL;
137 + free(tmp);
138 + tmp = NULL;
142 + if (!tmp)
144 + /* USERPROFILE is probably the closest equivalent to $HOME? */
145 + env = _dbus_getenv("USERPROFILE");
146 + if (env != NULL)
147 + tmp = strdup(env);
150 + if (!tmp)
151 + tmp = get_special_folder(CSIDL_PROFILE);
153 + if (!tmp)
154 + tmp = get_windows_directory_root();
156 + if (tmp) {
157 + _dbus_string_append (homedir, tmp);
158 + free(tmp);
159 + return TRUE;
162 + return FALSE;
165 +static void
166 +_dbus_set_homedir_from_drive_and_path_env(DBusString *homedir)
168 + const char *homepath;
169 + const char *homedrive;
171 + homedrive = _dbus_getenv("HOMEDRIVE");
172 + if (homedrive != NULL && *homedrive != '\0')
174 + _dbus_string_append(homedir,homedrive);
177 + homepath = _dbus_getenv("HOMEPATH");
178 + if (homepath != NULL && *homepath != '\0')
180 + _dbus_string_append(homedir,homepath);
185 * Appends the directory in which a keyring for the given credentials
186 * should be stored. The credentials should have either a Windows or
187 @@ -3398,8 +3532,6 @@ _dbus_append_keyring_directory_for_crede
189 DBusString homedir;
190 DBusString dotdir;
191 - const char *homepath;
192 - const char *homedrive;
194 _dbus_assert (credentials != NULL);
195 _dbus_assert (!_dbus_credentials_are_anonymous (credentials));
196 @@ -3407,18 +3539,12 @@ _dbus_append_keyring_directory_for_crede
197 if (!_dbus_string_init (&homedir))
198 return FALSE;
200 - homedrive = _dbus_getenv("HOMEDRIVE");
201 - if (homedrive != NULL && *homedrive != '\0')
203 - _dbus_string_append(&homedir,homedrive);
205 + _dbus_string_set_length(&homedir, 0);
206 + if (!_dbus_set_user_home(&homedir)) {
207 + _dbus_string_set_length(&homedir, 0);
208 + _dbus_set_homedir_from_drive_and_path_env(&homedir);
211 - homepath = _dbus_getenv("HOMEPATH");
212 - if (homepath != NULL && *homepath != '\0')
214 - _dbus_string_append(&homedir,homepath);
217 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
219 const char *override;