obtain current working directory in a portable way