2 * Simple manual paths check
9 #include "dbus/dbus-list.h"
10 #include "dbus/dbus-internals.h"
11 #include "dbus/dbus-sysdeps.h"
16 print_install_root (void)
18 DBusString runtime_prefix;
20 if (!_dbus_string_init (&runtime_prefix))
22 _dbus_assert_not_reached ("out of memory");
26 if (!_dbus_get_install_root (&runtime_prefix))
28 _dbus_assert_not_reached ("out of memory");
29 _dbus_string_free (&runtime_prefix);
33 if (_dbus_string_get_length (&runtime_prefix) == 0)
35 fprintf (stderr, "_dbus_get_install_root() failed\n");
36 _dbus_string_free (&runtime_prefix);
40 fprintf (stdout, "_dbus_get_install_root() returned '%s'\n",
41 _dbus_string_get_const_data (&runtime_prefix));
42 _dbus_string_free (&runtime_prefix);
47 print_service_dirs (void)
53 if (!_dbus_get_standard_session_servicedirs (&dirs))
54 _dbus_assert_not_reached ("couldn't get standard dirs");
56 while ((link = _dbus_list_pop_first_link (&dirs)))
58 printf ("default service dir: %s\n", (char *)link->data);
59 dbus_free (link->data);
60 _dbus_list_free_link (link);
66 static dbus_bool_t print_replace_install_prefix(const char *s)
70 if (!_dbus_string_init (&str))
72 _dbus_assert_not_reached ("out of memory");
76 if (!_dbus_string_append (&str, s) ||
77 !_dbus_replace_install_prefix (&str))
79 _dbus_assert_not_reached ("out of memory");
80 _dbus_string_free (&str);
84 fprintf(stdout, "replaced '%s' by '%s'\n", s,
85 _dbus_string_get_const_data (&str));
86 _dbus_string_free (&str);
91 main (int argc, char **argv)
93 if (!print_install_root())
96 if (!print_service_dirs())
99 if (!print_replace_install_prefix(DBUS_BINDIR "/dbus-daemon"))
102 if (!print_replace_install_prefix("c:\\Windows\\System32\\testfile"))