Move all this unzipping code into a generic function that contains platform-specific logic.