The optional mode parameter specifies the permissions of the directory,
the default value is 0o777.
Return an error object in case of error.
assert "/etc/".mkdir != null
	# Create a directory (and all intermediate directories if needed)
	#
	# The optional `mode` parameter specifies the permissions of the directory,
	# the default value is `0o777`.
	#
	# Return an error object in case of error.
	#
	#    assert "/etc/".mkdir != null
	fun mkdir(mode: nullable Int): nullable Error
	do
		mode = mode or else 0o777
		var s = self
		if is_windows then s = s.replace("\\", "/")
		var dirs = s.split_with("/")
		var path = new FlatBuffer
		if dirs.is_empty then return null
		if dirs[0].is_empty then
			# it was a starting /
			path.add('/')
		end
		var error: nullable Error = null
		for i in [0 .. dirs.length - 1[ do
			var d = dirs[i]
			if d.is_empty then continue
			path.append(d)
			path.add('/')
			if path.file_exists then continue
			var res = path.to_cstring.file_mkdir(mode)
			if not res and error == null then
				error = new IOError("Cannot create directory `{path}`: {sys.errno.strerror}")
			end
		end
		var res = s.to_cstring.file_mkdir(mode)
		if not res and error == null then
			error = new IOError("Cannot create directory `{path}`: {sys.errno.strerror}")
		end
		return error
	end
					lib/core/file.nit:1224,2--1262,4