- * Returns the standard directories for a session bus to look for service
- * activation files
- *
- * On UNIX this should be the standard xdg freedesktop.org data directories:
- *
- * XDG_DATA_HOME=${XDG_DATA_HOME-$HOME/.local/share}
- * XDG_DATA_DIRS=${XDG_DATA_DIRS-/usr/local/share:/usr/share}
- *
- * and
- *
- * DBUS_DATADIR
- *
- * @param dirs the directory list we are returning
- * @returns #FALSE on OOM
- */
-
-dbus_bool_t
-_dbus_get_standard_session_servicedirs (DBusList **dirs)
-{
- const char *xdg_data_home;
- const char *xdg_data_dirs;
- DBusString servicedir_path;
-
- if (!_dbus_string_init (&servicedir_path))
- return FALSE;
-
- xdg_data_home = _dbus_getenv ("XDG_DATA_HOME");
- xdg_data_dirs = _dbus_getenv ("XDG_DATA_DIRS");
-
- if (xdg_data_home != NULL)
- {
- if (!_dbus_string_append (&servicedir_path, xdg_data_home))
- goto oom;
- }
- else
- {
- const DBusString *homedir;
- DBusString local_share;
-
- if (!_dbus_homedir_from_current_process (&homedir))
- goto oom;
-
- if (!_dbus_string_append (&servicedir_path, _dbus_string_get_const_data (homedir)))
- goto oom;
-
- _dbus_string_init_const (&local_share, "/.local/share");
- if (!_dbus_concat_dir_and_file (&servicedir_path, &local_share))
- goto oom;
- }
-
- if (!_dbus_string_append (&servicedir_path, ":"))
- goto oom;
-
- if (xdg_data_dirs != NULL)
- {
- if (!_dbus_string_append (&servicedir_path, xdg_data_dirs))
- goto oom;
-
- if (!_dbus_string_append (&servicedir_path, ":"))
- goto oom;
- }
- else
- {
- if (!_dbus_string_append (&servicedir_path, "/usr/local/share:/usr/share:"))
- goto oom;
- }
-
- /*
- * add configured datadir to defaults
- * this may be the same as an xdg dir
- * however the config parser should take
- * care of duplicates
- */
- if (!_dbus_string_append (&servicedir_path, DBUS_DATADIR))
- goto oom;
-
- if (!_dbus_split_paths_and_append (&servicedir_path,
- DBUS_UNIX_STANDARD_SESSION_SERVICEDIR,
- dirs))
- goto oom;
-
- _dbus_string_free (&servicedir_path);
- return TRUE;
-
- oom:
- _dbus_string_free (&servicedir_path);
- return FALSE;
-}
-
-
-/**
- * Returns the standard directories for a system bus to look for service
- * activation files
- *
- * On UNIX this should be the standard xdg freedesktop.org data directories:
- *
- * XDG_DATA_DIRS=${XDG_DATA_DIRS-/usr/local/share:/usr/share}
- *
- * and
- *
- * DBUS_DATADIR
- *
- * On Windows there is no system bus and this function can return nothing.
- *
- * @param dirs the directory list we are returning
- * @returns #FALSE on OOM
- */
-
-dbus_bool_t
-_dbus_get_standard_system_servicedirs (DBusList **dirs)
-{
- const char *xdg_data_dirs;
- DBusString servicedir_path;
-
- if (!_dbus_string_init (&servicedir_path))
- return FALSE;
-
- xdg_data_dirs = _dbus_getenv ("XDG_DATA_DIRS");
-
- if (xdg_data_dirs != NULL)
- {
- if (!_dbus_string_append (&servicedir_path, xdg_data_dirs))
- goto oom;
-
- if (!_dbus_string_append (&servicedir_path, ":"))
- goto oom;
- }
- else
- {
- if (!_dbus_string_append (&servicedir_path, "/usr/local/share:/usr/share:"))
- goto oom;
- }
-
- /*
- * Add configured datadir to defaults. This may be the same as one
- * of the XDG directories. However, the config parser should take
- * care of the duplicates.
- *
- * Also, append /lib as counterpart of /usr/share on the root
- * directory (the root directory does not know /share), in order to
- * facilitate early boot system bus activation where /usr might not
- * be available.
- */
- if (!_dbus_string_append (&servicedir_path,
- DBUS_DATADIR":"
- "/lib:"))
- goto oom;
-
- if (!_dbus_split_paths_and_append (&servicedir_path,
- DBUS_UNIX_STANDARD_SYSTEM_SERVICEDIR,
- dirs))
- goto oom;
-
- _dbus_string_free (&servicedir_path);
- return TRUE;
-
- oom:
- _dbus_string_free (&servicedir_path);
- return FALSE;
-}
-
-/**
- * Append the absolute path of the system.conf file
- * (there is no system bus on Windows so this can just
- * return FALSE and print a warning or something)
- *
- * @param str the string to append to
- * @returns #FALSE if no memory
- */
-dbus_bool_t
-_dbus_append_system_config_file (DBusString *str)
-{
- return _dbus_string_append (str, DBUS_SYSTEM_CONFIG_FILE);
-}
-
-/**
- * Append the absolute path of the session.conf file.
- *
- * @param str the string to append to
- * @returns #FALSE if no memory
- */
-dbus_bool_t
-_dbus_append_session_config_file (DBusString *str)
-{
- return _dbus_string_append (str, DBUS_SESSION_CONFIG_FILE);
-}
-
-/**