Fix realpath() with multiple ../../../ ascendant paths, and extend option rather than overwrite