currentDirectory() { var buf = String(); reserve(buf, 1024); while (true) { var result = getcwd(Pointer[Int8](&buf[0]), size(buf)); if (not null?(result)) break; if (errno() != ERANGE) error(errorMessage()); reserve(buf, 2*size(buf)); } // 'resize' is not yet available // resize(buf, libc.strlen(&buf[0])); buf.size = libc.strlen(Pointer[Int8](&buf[0])); return move(buf); } error: Invalid argument