[gnome-text-editor] path: ignore path collapse/expand on windows



commit 3832990a53746e357a0671caf8b4f31d279e5df8
Author: Christian Hergert <chergert redhat com>
Date:   Sat Aug 13 22:38:08 2022 -0700

    path: ignore path collapse/expand on windows
    
    Fixes #451

 src/editor-path.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/editor-path.c b/src/editor-path.c
index d468049..2382f6c 100644
--- a/src/editor-path.c
+++ b/src/editor-path.c
@@ -22,15 +22,20 @@
 
 #include "config.h"
 
+#include <glib.h>
 #include <string.h>
-#include <unistd.h>
-#include <wordexp.h>
+
+#ifdef G_OS_UNIX
+# include <unistd.h>
+# include <wordexp.h>
+#endif
 
 #include "editor-path-private.h"
 
-gchar *
+char *
 _editor_path_expand (const gchar *path)
 {
+#ifdef G_OS_UNIX
   wordexp_t state = { 0 };
   char *escaped = NULL;
   char *ret = NULL;
@@ -55,11 +60,15 @@ _editor_path_expand (const gchar *path)
   g_free (escaped);
 
   return ret;
+#else
+  return g_strdup (path);
+#endif
 }
 
-gchar *
+char *
 _editor_path_collapse (const gchar *path)
 {
+#ifdef G_OS_UNIX
   g_autofree gchar *expanded = NULL;
 
   if (path == NULL)
@@ -77,4 +86,7 @@ _editor_path_collapse (const gchar *path)
                              NULL);
 
   return g_steal_pointer (&expanded);
+#else
+  return g_strdup (path);
+#endif
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]