Hey guys,
How can I get path to my resources on simulator and device? I have this code: [code] NSString *tytul = [NSString stringWithUTF8String: tytul_c];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *myPathDocs = [documentsDirectory stringByAppendingPathComponent:tytul];
const char *sciezka;
if (![[NSFileManager defaultManager] fileExistsAtPath:tytul])
{
NSString *stringWithoutTXT = [tytul stringByReplacingOccurrencesOfString:@".txt" withString:@""];
NSString *myPathInfo = [[NSBundle mainBundle] pathForResource:stringWithoutTXT ofType:@"txt"];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSLog(@"%@",myPathDocs);
//sciezka = [myPathDocs UTF8String];
sciezka = [myPathInfo UTF8String];
return sciezka;
}
[/code]
And it works fine on the device but NOT on the simulator. How can I fix it? And where should I put my resources? Now, I put them in Documents, in project folder. Is it ok?