Change the current working directory

"/etc".chdir
assert getcwd == "/etc"
"..".chdir
assert getcwd == "/"

Return an error object in case of error.

assert "/etc".chdir == null
assert "/fail/does no/exist".chdir != null
assert getcwd == "/etc"

Property definitions

core :: file $ Text :: chdir
	# Change the current working directory
	#
	#     "/etc".chdir
	#     assert getcwd == "/etc"
	#     "..".chdir
	#     assert getcwd == "/"
	#
	# Return an error object in case of error.
	#
	#     assert "/etc".chdir == null
	#     assert "/fail/does no/exist".chdir != null
	#     assert getcwd == "/etc" # unchanger
	fun chdir: nullable Error
	do
		var res = to_cstring.file_chdir
		if res then return null
		var error = new IOError("Cannot change directory to `{self}`: {sys.errno.strerror}")
		return error
	end
lib/core/file.nit:1279,2--1297,4