Assume that DBUS_DATADIR is absolute on Windows
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 2 Oct 2015 15:51:59 +0000 (16:51 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 5 Oct 2015 15:29:54 +0000 (16:29 +0100)
Both build systems arrange for this to be the case,
and we already assume that it's absolute on Unix.
On Windows, it's probably going to be /mingw/share or
something; it gets relocated via _dbus_replace_install_prefix()
at runtime.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
bus/config-parser.c
dbus/dbus-sysdeps-util-win.c

index a0fc47c..15ce8ff 100644 (file)
@@ -3413,17 +3413,13 @@ test_default_session_servicedirs (void)
   DBusString install_root_based;
 
   if (!_dbus_string_init (&install_root_based) ||
-      !_dbus_get_install_root (&install_root_based))
-    _dbus_assert_not_reached ("OOM getting install root");
+      !_dbus_string_append (&install_root_based, DBUS_DATADIR) ||
+      !_dbus_replace_install_prefix (&install_root_based))
+    _dbus_assert_not_reached ("OOM getting relocated DBUS_DATADIR");
 
-  if (_dbus_string_get_length (&install_root_based) > 0)
-    {
-      if (!_dbus_string_append (&install_root_based, DBUS_DATADIR) ||
-          !_dbus_string_append (&install_root_based, "/dbus-1/services"))
-        _dbus_assert_not_reached ("OOM appending to install root");
+  _dbus_assert (_dbus_path_is_absolute (&install_root_based));
 
-      test_session_service_dir_matches[0] = _dbus_string_get_const_data (&install_root_based);
-    }
+  test_session_service_dir_matches[0] = _dbus_string_get_const_data (&install_root_based);
 
 #endif
 
index 71296fa..d38f02b 100644 (file)
@@ -1574,16 +1574,14 @@ _dbus_get_standard_session_servicedirs (DBusList **dirs)
       }
   }
 #else
-/*
- the code for accessing services requires absolute base pathes
- in case DBUS_DATADIR is relative make it absolute
-*/
   {
     DBusString p;
 
     if (!_dbus_string_init (&p))
       goto oom;
 
+    /* DBUS_DATADIR is assumed to be absolute; the build systems should
+     * ensure that. */
     if (!_dbus_string_append (&p, DBUS_DATADIR) ||
         !_dbus_replace_install_prefix (&p))
       {
@@ -1591,18 +1589,6 @@ _dbus_get_standard_session_servicedirs (DBusList **dirs)
         goto oom;
       }
 
-    if (!_dbus_path_is_absolute (&p))
-      {
-        /* this only works because this is the first thing in the
-         * servicedir_path; if it wasn't, we'd have to use a temporary
-         * string and copy it in */
-        if (!_dbus_get_install_root (&servicedir_path))
-          {
-            _dbus_string_free (&p);
-            goto oom;
-          }
-      }
-
     if (!_dbus_string_append (&servicedir_path,
           _dbus_string_get_const_data (&p)))
       {