$OpenBSD: patch-libide_util_ide-posix_c,v 1.3 2017/11/03 12:39:51 ajacoutot Exp $

Index: libide/util/ide-posix.c
--- libide/util/ide-posix.c.orig
+++ libide/util/ide-posix.c
@@ -21,7 +21,11 @@
 #include <sys/user.h>
 #include <sys/utsname.h>
 #include <unistd.h>
+#if !defined(__OpenBSD__)
 #include <wordexp.h>
+#else
+#include <glob.h>
+#endif
 
 #include "ide-posix.h"
 
@@ -92,6 +96,7 @@ ide_get_system_page_size (void)
  * Returns: (transfer full): A newly allocated string containing the
  *   expansion. A copy of the input string upon failure to expand.
  */
+#if !defined(__OpenBSD__)
 gchar *
 ide_path_expand (const gchar *path)
 {
@@ -116,6 +121,33 @@ ide_path_expand (const gchar *path)
 
   return ret;
 }
+#else
+gchar *
+ide_path_expand (const gchar *path)
+{
+  glob_t state;
+  gchar *ret = NULL;
+  int r;
+
+  if (path == NULL)
+    return NULL;
+
+  r = glob (path, GLOB_ERR, NULL, &state);
+  if(r == 0 && state.gl_pathc == 1 && state.gl_pathv) {
+    ret = g_strdup (state.gl_pathv[0]);
+  }
+  globfree(&state);
+
+  if (!g_path_is_absolute (ret))
+    {
+      g_autofree gchar *freeme = ret;
+
+      ret = g_build_filename (g_get_home_dir (), freeme, NULL);
+    }
+
+  return ret;
+}
+#endif
 
 /**
  * ide_path_collapse:
