BusDesktopFile *desktop_file,
DBusError *error)
{
- char *name, *exec, *user;
+ char *name, *exec, *user, *exec_tmp;
BusActivationEntry *entry;
DBusStat stat_buf;
DBusString file_path;
name = NULL;
exec = NULL;
user = NULL;
+ exec_tmp = NULL;
entry = NULL;
dbus_error_init (&tmp_error);
if (!bus_desktop_file_get_string (desktop_file,
DBUS_SERVICE_SECTION,
DBUS_SERVICE_EXEC,
- &exec,
+ &exec_tmp,
error))
goto failed;
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
failed:
dbus_free (name);
- dbus_free (exec);
+ dbus_free (exec_tmp);
dbus_free (user);
_dbus_string_free (&file_path);
#### 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")
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)
D-Bus $VERSION
==============
- prefix: ${prefix}
+ prefix: ${EXPANDED_PREFIX}
exec_prefix: ${exec_prefix}
libdir: ${EXPANDED_LIBDIR}
libexecdir: ${EXPANDED_LIBEXECDIR}
#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 */
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)
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"
*
* and
*
- * DBUS_DATADIR
+ * relocated DBUS_DATADIR
*
* @param dirs the directory list we are returning
* @returns #FALSE on OOM
}
}
#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");
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