+#ifdef DBUS_USE_OUTPUT_DEBUG_STRING
+ {
+ char *last_period, *last_slash;
+ GetModuleFileName(0,module_name,sizeof(module_name)-1);
+ last_period = _mbsrchr(module_name,'.');
+ if (last_period)
+ *last_period ='\0';
+ last_slash = _mbsrchr(module_name,'\\');
+ if (last_slash)
+ strcpy(module_name,last_slash+1);
+ strcat(module_name,": ");
+ }
+#endif
+ }
+}
+
+/** @def DBUS_IS_DIR_SEPARATOR(c)
+ * macro for checking if character c is a patch separator
+ *
+ * @todo move to a header file so that others can use this too
+ */
+#ifdef DBUS_WIN
+#define DBUS_IS_DIR_SEPARATOR(c) (c == '\\' || c == '/')
+#else
+#define DBUS_IS_DIR_SEPARATOR(c) (c == '/')
+#endif
+
+/**
+ remove source root from file path
+ the source root is determined by
+*/
+static char *_dbus_file_path_extract_elements_from_tail(const char *file,int level)
+{
+ static int prefix = -1;
+
+ if (prefix == -1)
+ {
+ char *p = (char *)file + strlen(file);
+ int i = 0;
+ prefix = 0;
+ for (;p >= file;p--)
+ {
+ if (DBUS_IS_DIR_SEPARATOR(*p))
+ {
+ if (++i >= level)
+ {
+ prefix = p-file+1;
+ break;
+ }
+ }
+ }