diff options
author | Tor Lillqvist <tml@iki.fi> | 2009-10-21 15:49:03 +0300 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2009-12-01 09:20:27 +0100 |
commit | 22e434ab67fe431e0bd23f10eae430955f4d3daf (patch) | |
tree | bdf16567947337ff2bd6c159f70b9e44502564e0 | |
parent | db7717869a0f500a934e0b838955411eb8d10b4f (diff) | |
download | dbus-22e434ab67fe431e0bd23f10eae430955f4d3daf.tar.gz |
Look for config files also in the normal Unix-style location (cherry picked from commit 445d1f780fb916f9087c0d95e7594ee5a425d43f)
-rw-r--r-- | dbus/dbus-sysdeps-win.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index 2a2619d6..79390080 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -3328,7 +3328,9 @@ _dbus_get_install_root(char *prefix, int len) the following path layout install-root/ bin/dbus-daemon[d].exe - etc/<config-file>.conf + 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 @@ -3339,12 +3341,11 @@ _dbus_get_config_file_name(DBusString *config_file, char *s) { char path[MAX_PATH*2]; int path_size = sizeof(path); - int len = 4 + strlen(s); if (!_dbus_get_install_root(path,path_size)) return FALSE; - if(len > sizeof(path)-2) + if(strlen(s) + 4 + strlen(path) > sizeof(path)-2) return FALSE; strcat(path,"etc\\"); strcat(path,s); @@ -3358,9 +3359,9 @@ _dbus_get_config_file_name(DBusString *config_file, char *s) { if (!_dbus_get_install_root(path,path_size)) return FALSE; - if(len + strlen(path) > sizeof(path)-2) + if(strlen(s) + 11 + strlen(path) > sizeof(path)-2) return FALSE; - strcat(path,"bus\\"); + strcat(path,"etc\\dbus-1\\"); strcat(path,s); if (_dbus_file_exists(path)) @@ -3368,6 +3369,21 @@ _dbus_get_config_file_name(DBusString *config_file, char *s) 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; } |