And
this works fine on linux, but I wonder. On other systems, is "." and
".." allowed as file names? Couldn't a windows user actually end up with
a file name named "." and this method would fail?
Windows treats dots in filenames specially as well, although differently specially. I am not sure about . but .. certainly works on Windows if you're not in the drive's root. There are some other situations where dots in names are rejected (two or more in a row, other than .. itself, IIRC?) because of backward compatibility.