Bug in pathInDocumentDirectory function?


#1

I was NSLogging the pathname returned by the NString *pathInDocumentDirectory(NSString *fileName) function in FileHelpers.m and it looks like the pathname returned by the function doesn’t prepend a slash before the fileName variable.
So if fileName is called “possession.data” and you want it saved into the Documents folder, the fileName part of the returned string would look like this: “Documentspossession.data”.


#2

I have just looked at the output I get from the following

    // Log Path
    NSLog(@"Filepath :%@", [documentDirectory stringByAppendingPathComponent]);

There are no issues, here is the output

2011-12-30 15:32:33.693 Homepwner[11999:b303] Filepath :/Users/icoder/Library/Application Support/iPhone Simulator/4.3.2/Applications/85AF48BC-E50F-44C7-9AFA-EA26C60D1C0E/Documents/possessions.data

#3

Thanks for checking and you’re right, it was a mistake on my part. I incorrectly chose the stringByAppendingString: method, instead of stringByAppendingPathComponent:.