Move duplicate filemanip code to a Platforms/General/ source.