Skip to content

Instantly share code, notes, and snippets.

@zsprackett
Created September 28, 2010 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsprackett/601490 to your computer and use it in GitHub Desktop.
Save zsprackett/601490 to your computer and use it in GitHub Desktop.
this.loadAccessToken = function(pService)
{
Ti.API.debug('Loading access token for service [' + pService + '].');
try
{
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirect
ory, pService + '.config');
}
catch(ex)
{
return;
}
if (file.exists == false) return;
try
{
var contents = file.read();
Ti.API.debug('got contents');
}
catch(ex)
{
Ti.API.debug('contents exception');
return;
}
if (contents == null) return;
try
{
Ti.API.debug('Parsing config');
var config = JSON.parse(contents.text);
Ti.API.debug('Done parsing config');
}
catch(ex)
{
return;
}
if (config == null) return;
Ti.API.debug('Looks good 1.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment