iDevGames Forums
Crash during file save - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Crash during file save (/thread-5697.html)



Crash during file save - Coin - Mar 29, 2005 02:37 PM

Crash while generating temporarly files

Code:
NSString *path = [@"~/Desktop/.temp" stringByExpandingTildeInPath];
    path = [NSString stringWithFormat:@"%@/%@", path, [[source objectAtIndex:selected] name]];
    
    NSLog(path);
    
    [tempData writeToFile:path atomically:NO];


the logged path is /Users/admin/Desktop/.temp/animal.rtf

i also have tried this

Code:
NSString *path = [@"~/Desktop/.temp" stringByExpandingTildeInPath];
    path = [NSString stringWithFormat:@"\"%@/%@\"", path, [[source objectAtIndex:selected] name]];
    
    NSLog(path);
    
    [tempData writeToFile:path atomically:NO];


i know that the NSData is fine because this code worked earlier, then i messed with the path stuff and it stopped working

when i go and look in .temp there is nothing in it


Crash during file save - kodex - Mar 29, 2005 03:11 PM

Did you run a fileExistsAtPath: to verify that it is correctly finding the directory.

Try something of this nature, it sounds like the path isnt working for you.

NSFileManager *manager = [NSFileManager defaultManager];
if(![manager fileExistsAtPath: path])
{//Failed
}

This should help you understand what is failing a little better


Crash during file save - Steven - Mar 29, 2005 05:07 PM

Crash info (backtrace, failed assertions, and the like) are very useful too. Are you sure that you have no null pointers lying around? Also, NSLog(path) is bad practice - what if you have a path with a % symbol in it? You should NSLog(@"%@",path) instead.


Crash during file save - Coin - Mar 29, 2005 05:22 PM

werid. i left the house came back 2 hours later and ALL the stuff it used to crash on (spaces in name, spaces in file) are gone it works regardless......

no code changes at all.....


Crash during file save - maaaaark - Mar 29, 2005 05:39 PM

that happens to me a lot. i have so much source code on this computer Sad i have so many duplicates of the same projects, and copies and etc Sad

I need source control Smile