I have had a look at all the comments and I am starting to see what I should be doing. To that end I have modified my code (see below) I have changed new
You don't append the delimiter. You append the next path component (eg filename, dir, etc). This avoids you needing to know the delimiter for your particular system.
NSMutableString* mutablePath = [NSMutableString string];
NSString* fullPath = [rootPath stringByAppendingPathComponent:filename];
[mutablePath setString:fullPath]; // OK to setString: of Mutable with non-Mutable
[mutablePath appendString:someOtherString]; // This won't cause an exception
// Example to clarify on comments below
{
// This will cause a compiler warning.
// warning: incompatible Objective-C types assigning
// ‘struct NSString *’, expected ‘struct NSMutableString *’
NSMutableString* ms = [@"FOO" stringByAppendingPathComponent:@"BAR"];
}
There is a fairly clear example in the documentation.