Make Windows dbus-daemon look for the config file we install
authorRalf Habacker <ralf.habacker@freenet.de>
Sun, 20 Sep 2015 11:47:23 +0000 (13:47 +0200)
committerRalf Habacker <ralf.habacker@freenet.de>
Sun, 20 Sep 2015 11:48:28 +0000 (13:48 +0200)
The canonical location for bus setup changed from
${sysconfdir}/dbus-1 to ${datadir}/dbus-1 (or their CMake
equivalents) in version 1.9.18.

Also stop trying to use bus/session.conf from the build tree,
which will not work if our ${prefix} contains an older
${sysconfdir}/dbus-1/session.conf.

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

index e83c539..57c353e 100644 (file)
@@ -1647,6 +1647,28 @@ _dbus_get_standard_system_servicedirs (DBusList **dirs)
   return TRUE;
 }
 
+static dbus_bool_t
+_dbus_get_config_file_name (DBusString *str,
+                            const char *basename)
+{
+  DBusString tmp;
+
+  if (!_dbus_string_append (str, _dbus_windows_get_datadir ()))
+    return FALSE;
+
+  _dbus_string_init_const (&tmp, "dbus-1");
+
+  if (!_dbus_concat_dir_and_file (str, &tmp))
+    return FALSE;
+
+  _dbus_string_init_const (&tmp, basename);
+
+  if (!_dbus_concat_dir_and_file (str, &tmp))
+    return FALSE;
+
+  return TRUE;
+}
+
 /**
  * Append the absolute path of the system.conf file
  * (there is no system bus on Windows so this can just
index b3b459f..69644b0 100644 (file)
@@ -3330,71 +3330,6 @@ _dbus_get_install_root(char *prefix, int len)
     return TRUE;
 }
 
-/** 
-  find config file either from installation or build root according to 
-  the following path layout 
-    install-root/
-      bin/dbus-daemon[d].exe
-      etc/<config-file>.conf *or* etc/dbus-1/<config-file>.conf
-      (the former above is what dbus4win uses, the latter above is
-      what a "normal" Unix-style "make install" uses)
-
-    build-root/
-      bin/dbus-daemon[d].exe
-      bus/<config-file>.conf 
-*/
-dbus_bool_t 
-_dbus_get_config_file_name(DBusString *config_file, char *s)
-{
-  char path[MAX_PATH*2];
-  int path_size = sizeof(path);
-
-  if (!_dbus_get_install_root(path,path_size))
-    return FALSE;
-
-  if(strlen(s) + 4 + strlen(path) > sizeof(path)-2)
-    return FALSE;
-  strcat(path,"etc\\");
-  strcat(path,s);
-  if (_dbus_file_exists(path)) 
-    {
-      // find path from executable 
-      if (!_dbus_string_append (config_file, path))
-        return FALSE;
-    }
-  else 
-    {
-      if (!_dbus_get_install_root(path,path_size))
-        return FALSE;
-      if(strlen(s) + 11 + strlen(path) > sizeof(path)-2)
-        return FALSE;
-      strcat(path,"etc\\dbus-1\\");
-      strcat(path,s);
-  
-      if (_dbus_file_exists(path)) 
-        {
-          if (!_dbus_string_append (config_file, path))
-            return FALSE;
-        }
-      else
-        {
-          if (!_dbus_get_install_root(path,path_size))
-            return FALSE;
-          if(strlen(s) + 4 + strlen(path) > sizeof(path)-2)
-            return FALSE;
-          strcat(path,"bus\\");
-          strcat(path,s);
-          
-          if (_dbus_file_exists(path)) 
-            {
-              if (!_dbus_string_append (config_file, path))
-                return FALSE;
-            }
-        }
-    }
-  return TRUE;
-}    
-
 /* See comment in dbus-sysdeps-unix.c */
 dbus_bool_t
 _dbus_lookup_session_address (dbus_bool_t *supported,
index a536770..e9b30d7 100644 (file)
@@ -85,10 +85,6 @@ _dbus_win_sid_to_name_and_domain (dbus_uid_t uid,
 dbus_bool_t _dbus_file_exists (const char *filename);
 
 DBUS_PRIVATE_EXPORT
-dbus_bool_t _dbus_get_config_file_name(DBusString *config_file, 
-                                       char *s);
-
-DBUS_PRIVATE_EXPORT
 dbus_bool_t _dbus_get_install_root(char *prefix, int len);
 
 void        _dbus_threads_windows_init_global (void);