         callback() if callback
       )
 
+  preSync: ->
+    deferred = new $.Deferred()
+
+    if Sync.oauth.service is "skydrive"
+      $.ajax(
+        Sync.generateRequest
+          request: "findappdir"
+      ).done((data) ->
+        for item in data.data
+          # Break when we find the springseed folder
+          if item.name.toLowerCase() is "springseed"
+            Sync.syncMeta.folderid = item.id
+            break
+        $.ajax(
+          Sync.generateRequest
+            request: "listappdir"
+        ).done((data) ->
+          Sync.syncMeta.map = {}
+          for item in data.data
+            Sync.syncMeta.map[item.name] = item.id
+          deferred.resolve()
+        )
+      )
+    else
+      deferred.resolve()
+
+    return deferred.promise()
+
   # The main syncing function.
   # It downloads the meta, then updates it to latest version as well as doing various other io.
   # It's magic. Trust me.
   doSync: ->
+
+    console.log("bosh")
 
     # Downloads a meta file.
     $.ajax(


  oauth: JSON.parse localStorage.oauth or '{"service": "undefined"}'
  queue: JSON.parse localStorage.Queue or '{"Note": {}, "Notebook": {}}'

  # Hold pending actions
  pending: []

      if opts.request is "refresh"
        params.type = "get"
        params.url = "https://springseed-oauth.herokuapp.com:443/refresh/skydrive?code=" + Sync.oauth.refresh_token

      else if opts.request is "me"
        params.type = "get"
        params.url = "https://apis.live.net/v5.0/me?access_token=" + Sync.oauth.access_token

      else if opts.request is "root"
        params.type = "get"
        params.url = "https://apis.live.net/v5.0/me/skydrive?access_token=" + Sync.oauth.access_token

      else if opts.request is "makeappdir"
        params.type = "post"
        params.contentType = "application/json"
        params.url = "https://apis.live.net/v5.0/me/skydrive/my_documents?access_token=" + Sync.oauth.access_token
        params.data = '{"name": "Springseed", "description": "Springseed App Data"}'

      else if opts.request is "findappdir"
        params.type = "get"
        params.url = "https://apis.live.net/v5.0/me/skydrive/my_documents/files?access_token=" + Sync.oauth.access_token

      else if opts.request is "listappdir"
        params.type = "get"
        params.url = "https://apis.live.net/v5.0/" + Sync.syncMeta.folderid + "/files?access_token=" + Sync.oauth.access_token

      else if opts.request is "download"
        params.type = "get"
        params.url = "https://apis.live.net/v5.0/" + Sync.syncMeta.map[opts.filename + ".seed"] + "/content?access_token=" + Sync.oauth.access_token

    params # return

