Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
  2.     NSString* path = [defaults objectForKey:@"kInvisionFolderPath"];
  3.     if(path == nil)
  4.     {
  5.         path = [NSHomeDirectory() stringByAppendingPathComponent:@"Invision"];
  6.         [defaults setObject:path forKey:@"kInvisionFolderPath"];
  7.         [defaults synchronize];
  8.     }
  9.    
  10.     LSSharedFileListRef sf = LSSharedFileListCreate(NULL, kLSSharedFileListFavoriteItems, NULL);
  11.     CFURLRef url = (CFURLRef)[NSURL URLWithString:path];
  12.     if(!pathExistsInSharedFileList(url, sf))
  13.     {
  14.         LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(sf, kLSSharedFileListItemBeforeFirst, NULL, NULL, url, NULL, NULL);
  15.         if(item)
  16.             CFRelease(item);
  17.     }
  18.     else
  19.         NSLog(@"Path exists");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement