From a9f7fe8cd4c9d51e407acafe78d2bc89d3b98f6b Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 22 Dec 2009 21:06:06 +0100 Subject: [PATCH] [windows] Use \r\n as delimiter to split lines on Windows Fixes bgo#605146. --- backend/comics/comics-document.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c index 9f657c24..b66f4ce7 100644 --- a/backend/comics/comics-document.c +++ b/backend/comics/comics-document.c @@ -42,6 +42,16 @@ #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) { -- 2.43.5