implement a platform independent version of basename

This fixes the test Cache::testGetById() for Windows.

@karlitschek @butonic @blizzz @MTGap @icewind1991 THX