Porting part of Composer's filesystem to get around renaming files across drives

See symfony/symfony-installer#46 and symfony/symfony#12533
Making further changes thanks to @xabbuh
Merge pull request #9 from weaverryan/porting-composer-filesystem

Porting part of Composer's filesystem to get around rename issue