I'm running test cases which uses sqlite database to test my code on iPhone simulator using default SenTestingkit, when i try to get the home directory using either of the following ways
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsPath = [paths objectAtIndex:0];
or
NSString *home = NSHomeDirectory();
i got a wrong path that points to the following bath
/Users/{user}/Library/Application Support/iPhone Simulator/5.1
and i couldn't create the sqlite database, any idea how to get the right path in the Test cases?
Thanks
I found the answer :)
first I had to detect whether i'm in TestCase or running project using NSClassFromString for the SenTest Class then construct the path according to each case