tools: Use platform abstraction for I/O.