#1943 - Make legal_file::change_extension more robust.

Previously would fail with dots in the directory but no extension.  Added unit tests to verify the new change works.