Made file handling code cross-platform. Mono is now kind of working.