core: implement `MinHeap::clear` and intro `Pointer::nul`
[nit.git] / lib / core / file.nit
index c78f6d4..6701588 100644 (file)
@@ -1057,7 +1057,8 @@ redef class String
        # ~~~
        fun simplify_path: String
        do
-               var a = self.split_with("/")
+               var path_sep = if is_windows then "\\" else "/"
+               var a = self.split_with(path_sep)
                var a2 = new Array[String]
                for x in a do
                        if x == "." and not a2.is_empty then continue # skip `././`
@@ -1508,7 +1509,12 @@ private extern class NativeFile `{ FILE* `}
        `}
 
        fun io_write(buf: CString, from, len: Int): Int `{
-               return fwrite(buf+from, 1, len, self);
+               size_t res = fwrite(buf+from, 1, len, self);
+#ifdef _WIN32
+               // Force flushing buffer because end of line does not trigger a flush
+               fflush(self);
+#endif
+               return (long)res;
        `}
 
        fun write_byte(value: Byte): Int `{