bldenv: Move file functions into file.c