xcode - How to specify working directory for sqlite3_open -


working in xcode works ok if execute double-clicking project down in working directory not xcode doing build , run. database isn't being found correctly.

how modify...

 sqlite3_open("airports.sqlite", &db); 

so can find airports.sqlite in current working directory?

copy database applications directory , after can use database :)

    nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory , nsuserdomainmask, yes);         nsstring *dbpath = [[paths objectatindex:0] stringbyappendingpathcomponent:@"airports.sqlite"];  bool success = [filemanager fileexistsatpath:dbpath];  if (!succes){      nsstring *defaultdbpath = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@"airports.sqlite"];                 bool success = [filemanager copyitematpath:defaultdbpath topath:dbpath error:&error];                  if (!success)                      nsassert1(0, @"failed create writable database file message '%@'.", [error localizeddescription]);                 else                     nslog(@"succesfully created writable database"); } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -