nullable: convert lib, tools and tests
[nit.git] / lib / standard / file.nit
index 7dbf17a..bbb45d2 100644 (file)
@@ -31,9 +31,7 @@ redef class Object
        # Print an `object' on the standard output (`stdout') and add a newline.
        protected meth print(object: Object)
        do
-               if object != null then
-                       stdout.write(object.to_s)
-               end
+               stdout.write(object.to_s)
                stdout.write("\n")
        end
 
@@ -54,12 +52,11 @@ end
 class FStream
 special IOS
 special NativeFileCapable
-       
        # The path of the file.
-       readable attr _path: String = null
+       readable attr _path: nullable String = null
 
        # The FILE *.
-       attr _file: NativeFile = null
+       attr _file: nullable NativeFile = null
 
        meth file_stat: FileStat
        do return _file.file_stat end
@@ -242,7 +239,7 @@ redef class String
        meth mkdir
        do
                var dirs = self.split_with("/")
-               var path = new String
+               var path = new Buffer
                if dirs.is_empty then return
                if dirs[0].is_empty then
                        # it was a starting /
@@ -252,7 +249,7 @@ redef class String
                        if d.is_empty then continue
                        path.append(d)
                        path.add('/')
-                       path.to_cstring.file_mkdir
+                       path.to_s.to_cstring.file_mkdir
                end
        end
 end