]> www.fi.muni.cz Git - evince.git/blobdiff - backend/comics/comics-document.c
[windows] Use \r\n as delimiter to split lines on Windows
[evince.git] / backend / comics / comics-document.c
index 9f657c24e1be667943bef0ce3e49532722267ef1..b66f4ce7187d4a663610e4882ada6ca7c915c962 100644 (file)
 #include "ev-document-thumbnails.h"
 #include "ev-file-helpers.h"
 
+#ifdef G_OS_WIN32
+/* On windows g_spawn_command_line_sync reads stdout in O_BINARY mode, not in O_TEXT mode.
+ * As a consequence, newlines are in a platform dependent representation (\r\n). This
+ * might be considered a bug in glib.
+ */
+#define EV_EOL "\r\n"
+#else
+#define EV_EOL "\n"
+#endif
+
 typedef enum
 {
        RARLABS,
@@ -414,7 +424,8 @@ comics_document_load (EvDocument *document,
        }
 
        /* FIXME: is this safe against filenames containing \n in the archive ? */
-       cb_files = g_strsplit (std_out, "\n", 0);
+       cb_files = g_strsplit (std_out, EV_EOL, 0);
+
        g_free (std_out);
 
        if (!cb_files) {