Commit ed79e030 authored by Fridrich Štrba's avatar Fridrich Štrba Committed by Ralf Habacker
Browse files

Patch relocating "exec" variable and position of service files

parent 14cc1162
......@@ -255,7 +255,7 @@ update_desktop_file_entry (BusActivation *activation,
BusDesktopFile *desktop_file,
DBusError *error)
{
char *name, *exec, *user;
char *name, *exec, *user, *exec_tmp;
BusActivationEntry *entry;
DBusStat stat_buf;
DBusString file_path;
......@@ -266,6 +266,7 @@ update_desktop_file_entry (BusActivation *activation,
name = NULL;
exec = NULL;
user = NULL;
exec_tmp = NULL;
entry = NULL;
dbus_error_init (&tmp_error);
......@@ -300,7 +301,7 @@ update_desktop_file_entry (BusActivation *activation,
if (!bus_desktop_file_get_string (desktop_file,
DBUS_SERVICE_SECTION,
DBUS_SERVICE_EXEC,
&exec,
&exec_tmp,
error))
goto failed;
......@@ -329,6 +330,9 @@ update_desktop_file_entry (BusActivation *activation,
entry = _dbus_hash_table_lookup_string (s_dir->entries,
_dbus_string_get_const_data (filename));
exec = strdup (_dbus_replace_install_prefix (exec_tmp));
if (entry == NULL) /* New file */
{
/* FIXME we need a better-defined algorithm for which service file to
......@@ -417,7 +421,7 @@ update_desktop_file_entry (BusActivation *activation,
failed:
dbus_free (name);
dbus_free (exec);
dbus_free (exec_tmp);
dbus_free (user);
_dbus_string_free (&file_path);
......
......@@ -1335,6 +1335,7 @@ AC_MSG_RESULT(yes)
#### find the actual value for $prefix that we'll end up with
## (I know this is broken and should be done in the Makefile, but
## that's a major pain and almost nobody actually seems to care)
AS_AC_EXPAND(EXPANDED_PREFIX, "$prefix")
AS_AC_EXPAND(EXPANDED_LOCALSTATEDIR, "$localstatedir")
AS_AC_EXPAND(EXPANDED_SYSCONFDIR, "$sysconfdir")
AS_AC_EXPAND(EXPANDED_BINDIR, "$bindir")
......@@ -1430,6 +1431,11 @@ fi
AC_SUBST(DBUS_USER)
AC_DEFINE_UNQUOTED(DBUS_USER,"$DBUS_USER", [User for running the system BUS daemon])
#### Prefix to install into
DBUS_PREFIX=$EXPANDED_PREFIX
AC_SUBST(DBUS_PREFIX)
AC_DEFINE_UNQUOTED(DBUS_PREFIX,"$DBUS_PREFIX", [Prefix for installing DBUS])
#### Direcotry to install data files into
DBUS_DATADIR=$EXPANDED_DATADIR
AC_SUBST(DBUS_DATADIR)
......@@ -1581,7 +1587,7 @@ echo "
D-Bus $VERSION
==============
prefix: ${prefix}
prefix: ${EXPANDED_PREFIX}
exec_prefix: ${exec_prefix}
libdir: ${EXPANDED_LIBDIR}
libexecdir: ${EXPANDED_LIBEXECDIR}
......
......@@ -3583,4 +3583,18 @@ _dbus_socket_can_pass_unix_fd(int fd) {
#endif
}
/*
* replaces the term DBUS_PREFIX in configure_time_path by the
* current dbus installation directory. On unix this function is a noop
*
* @param configure_time_path
* @return real path
*/
const char *
_dbus_replace_install_prefix (const char *configure_time_path)
{
return configure_time_path;
}
/* tests in dbus-sysdeps-util.c */
......@@ -2060,6 +2060,54 @@ _dbus_delete_file (const DBusString *filename,
return TRUE;
}
/* Forward declaration of prototype used in next function */
static dbus_bool_t
_dbus_get_install_root(char *prefix, int len);
/*
* replaces the term DBUS_PREFIX in configure_time_path by the
* current dbus installation directory. On unix this function is a noop
*
* @param configure_time_path
* @return real path
*/
const char *
_dbus_replace_install_prefix (const char *configure_time_path)
{
static char retval[1000];
#ifndef DBUS_PREFIX
strcpy (retval, configure_time_path);
#else
static char runtime_prefix[1000];
int len = 1000;
int i;
if (!configure_time_path)
return NULL;
if ((!_dbus_get_install_root(runtime_prefix, len) ||
strncmp (configure_time_path, DBUS_PREFIX "/",
strlen (DBUS_PREFIX) + 1))) {
strcat (retval, configure_time_path);
return retval;
}
strcpy (retval, runtime_prefix);
strcat (retval, configure_time_path + strlen (DBUS_PREFIX) + 1);
/* Somehow, in some situations, backslashes get collapsed in the string.
* Since windows C library accepts both forward and backslashes as
* path separators, convert all backslashes to forward slashes.
*/
for(i = 0; retval[i] != '\0'; i++) {
if(retval[i] == '\\')
retval[i] = '/';
}
#endif
return retval;
}
#if !defined (DBUS_DISABLE_ASSERT) || defined(DBUS_BUILD_TESTS)
#if defined(_MSC_VER) || defined(DBUS_WINCE)
......@@ -2683,6 +2731,21 @@ _dbus_make_file_world_readable(const DBusString *filename,
return TRUE;
}
/**
* return the relocated DATADIR
*
* @returns relocated DATADIR static string
*/
static const char *
_dbus_windows_get_datadir (void)
{
return _dbus_replace_install_prefix(DBUS_DATADIR);
}
#undef DBUS_DATADIR
#define DBUS_DATADIR _dbus_windows_get_datadir ()
#define DBUS_STANDARD_SESSION_SERVICEDIR "/dbus-1/services"
#define DBUS_STANDARD_SYSTEM_SERVICEDIR "/dbus-1/system-services"
......@@ -2697,7 +2760,7 @@ _dbus_make_file_world_readable(const DBusString *filename,
*
* and
*
* DBUS_DATADIR
* relocated DBUS_DATADIR
*
* @param dirs the directory list we are returning
* @returns #FALSE on OOM
......@@ -2727,8 +2790,11 @@ _dbus_get_standard_session_servicedirs (DBusList **dirs)
}
}
#else
if (!_dbus_string_append (&servicedir_path, DBUS_DATADIR _DBUS_PATH_SEPARATOR))
goto oom;
if (!_dbus_string_append (&servicedir_path, DBUS_DATADIR))
goto oom;
if (!_dbus_string_append (&servicedir_path, _DBUS_PATH_SEPARATOR))
goto oom;
#endif
common_progs = _dbus_getenv ("CommonProgramFiles");
......
......@@ -507,6 +507,16 @@ dbus_bool_t _dbus_change_to_daemon_user (const char *user,
void _dbus_flush_caches (void);
/*
* replaces the term DBUS_PREFIX in configure_time_path by the
* current dbus installation directory. On unix this function is a noop
*
* @param configure_time_path
* @return real path
*/
const char *
_dbus_replace_install_prefix (const char *configure_time_path);
/** @} */
DBUS_END_DECLS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment