/** * Open file. * * The constructor calls the fopen function to open the file handle and * throws a T_Exception_File on failure. The input $mode is also checked * for portability (it should include the 'b' binary indicator so original * line endings are preserved). The input modes available are: * * 'rb' reading only. * 'wb' writing only, truncate or create file. * * @param T_File_Path $fname full path to file * @param string $mode open mode (including 'b' indicator) */ function __construct(T_File_Path $fname, $mode) { if (strcmp('wb', $mode) == 0) { $this->fswap = $fname; $fname = new T_File_Path($fname->getDirName(), uniqid(rand(), true), null); // ^ make a tmp file in same dir as target } parent::__construct($fname, $mode); }