Skip to content

Instantly share code, notes, and snippets.

@benbahrenburg
Created December 29, 2011 02:08
Show Gist options
  • Save benbahrenburg/1531165 to your computer and use it in GitHub Desktop.
Save benbahrenburg/1531165 to your computer and use it in GitHub Desktop.
Per iOS 5 Ti 1.8 Way to find your SQLite file
function fetchDbFile(dbName){
Ti.API.info('We build the directory path to find ' + dbName + '.sql');
return Ti.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory, 'database', dbName + '.sql');
};
var myDbName = 'foo123';
Ti.API.info('We create a db to test our method')
var testDb = Ti.Database.open(myDbName);
Ti.API.info('No we get the file')
var dbFile = fetchDbFile(myDbName);
Ti.API.info('Did we find it? ' + dbFile.exists());
Ti.API.info('Here is the nativePath ' + dbFile.nativePath);
Ti.API.info('Example Finished');
@benbahrenburg
Copy link
Author

Please note this will not work in Titanium 1.8 on iOS 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment