Open files in binary mode, to avoid problems with line endings on win32

This commit is contained in:
Yevgen Muntyan 2007-04-09 18:12:44 -05:00
parent b6eb52e600
commit 2047e4c5cc
3 changed files with 7 additions and 4 deletions

View File

@ -125,7 +125,6 @@ def copy_files():
else:
do_cmd("%s %s/lib/moo/plugins/*/*.dll" % (strip, moo_windir))
do_cmd("%s %s/lib/moo/plugins/*/*.pyd" % (strip, moo_windir))
do_cmd("%s %s/bin/medit.exe %s/bin/libmoo.dll" % (strip, moo_windir, moo_windir))
do_cmd("%s %s/bin/medit.exe %s/bin/libmoo.dll" % (strip, moo_windir, moo_windir))
def build():

View File

@ -34,7 +34,7 @@
</configure>
</optimized>
</configurations>
<file_selector_dir>/home/muntyan/projects/moo/moo/mooedit/</file_selector_dir>
<file_selector_dir>/home/muntyan/projects/moo/build/debug/moo/mooedit/</file_selector_dir>
<run>
<args>--g-fatal-warnings --new-app</args>
<exe>medit/medit</exe>

View File

@ -44,6 +44,10 @@
#define DEFAULT_ENCODING_LIST ""
#define ENCODING_LOCALE "LOCALE"
#ifndef O_BINARY
#define O_BINARY 0
#endif
static GSList *UNTITLED = NULL;
static GHashTable *UNTITLED_NO = NULL;
@ -469,7 +473,7 @@ do_load (MooEdit *edit,
}
}
file = g_io_channel_new_file (filename, "r", error);
file = g_io_channel_new_file (filename, "rb", error);
if (!file)
return ERROR_FILE;
@ -835,7 +839,7 @@ do_write (MooEdit *edit,
#endif
errno = 0;
fd = g_open (filename, O_WRONLY | O_CREAT | O_TRUNC, mode);
fd = g_open (filename, O_BINARY | O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd == -1)
{