1

I'm an iOS developer and have never developed for Mac OSX, but I'm interested in the Dropbox Mac OS application's working logic. Exact questions are:

1) How can I programmatically do additional drive/folder that is shown in the Finder app as Dropbox does?

2) How can I detect that user has made modifications to dropbox folder from his computer? Is there any way to make some script(in applescript?????) to notify application when file contents change or does application has to control periodically whether any file has changed or not.

3) What's about OSX applications background activity limitations?

Olga Dalton
  • 829
  • 3
  • 15
  • 25

1 Answers1

6

1) use LSSharedFileList.
Add an item to the Finder/Save dialog sidebar

-(void) addPathToSharedItem:(NSString *)path
{
    CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:path]; 

    // Create a reference to the shared file list.
    LSSharedFileListRef favoriteItems = LSSharedFileListCreate(NULL,
                                                               kLSSharedFileListFavoriteItems, NULL);
    if (favoriteItems) {
        //Insert an item to the list.
        LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(favoriteItems,
                                                                     kLSSharedFileListItemLast, NULL, NULL,
                                                                     url, NULL, NULL);
        if (item){
            CFRelease(item);
        }
    }   

    CFRelease(favoriteItems);
}  

2) you can use FSEvent API.

The file system events API provides a way for your application to ask for notification when the contents of a directory hierarchy are modified.

3)take a look at Daemons and Agents technical note.

Daemons and agents, collectively known as background programs, are programs that operate without any graphical user interface

Community
  • 1
  • 1
Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
  • 1
    some people here always supportive and try to give a hand to other people in this community. but so many just always are just closed some people question – justicepenny Aug 01 '13 at 09:13