Switch to filesystem

depends on #550 
remove all these ancient c methods and replace them with < filesystem > or boost::filesystem