DBusList *dirs;
DBusList *link;
DBusString progs;
+ DBusString install_root_based;
int i;
dbus_bool_t ret = FALSE;
#ifdef DBUS_WIN
+ const char *tmp;
const char *common_progs;
- char buffer[1024];
#endif
- /* On Unix we don't actually use this variable, but it's easier to handle the
- * deallocation if we always allocate it, whether needed or not */
- if (!_dbus_string_init (&progs))
- _dbus_assert_not_reached ("OOM allocating progs");
+ /* On Unix we don't actually use these, but it's easier to handle the
+ * deallocation if we always allocate them, whether needed or not */
+ if (!_dbus_string_init (&progs) ||
+ !_dbus_string_init (&install_root_based))
+ _dbus_assert_not_reached ("OOM allocating strings");
#ifdef DBUS_WIN
- if (_dbus_get_install_root(buffer, sizeof(buffer)))
- {
- strcat(buffer,DBUS_DATADIR);
- strcat(buffer,"/dbus-1/services");
- test_session_service_dir_matches[0] = buffer;
- }
-#endif
+ if (!_dbus_string_append (&install_root_based, DBUS_DATADIR) ||
+ !_dbus_string_append (&install_root_based, "/dbus-1/services"))
+ goto out;
+
+ tmp = _dbus_replace_install_prefix (
+ _dbus_string_get_const_data (&install_root_based));
+
+ if (tmp == NULL ||
+ !_dbus_string_set_length (&install_root_based, 0) ||
+ !_dbus_string_append (&install_root_based, tmp))
+ goto out;
+
+ test_session_service_dir_matches[0] = _dbus_string_get_const_data (
+ &install_root_based);
-#ifndef DBUS_UNIX
common_progs = _dbus_getenv ("CommonProgramFiles");
if (common_progs)
ret = TRUE;
out:
+ _dbus_string_free (&install_root_based);
_dbus_string_free (&progs);
return ret;
}