Martin Heinrich - 2009-11-05

The change proposed in the details is not complete. The following change would fix the problem

NSString *expandedFileName = [fileName stringByExpandingTildeInPath];
if (![fileManager fileExistsAtPath: expandedfileName]) {
// if the we cannot create the file, raise a FileNotFoundException
// if (![fileManager createFileAtPath: fileName contents: nil attributes: nil]) {
if (![fileManager createFileAtPath: expandedFileName contents: nil attributes: nil]) {
[NSException raise: @"FileNotFoundException" format: @"Couldn't create a file at %@", expandedFileName];
}
}

// if we had a previous file name, close it and release the file handle
if (fileName != nil) {
[self closeFile];
}

// open a file handle to the file
// [self setFileHandle: [NSFileHandle fileHandleForWritingAtPath: fileName]];
[self setFileHandle: [NSFileHandle fileHandleForWritingAtPath: expandedFileName]];