### Find Dropbox Path

Example of finding the Dropbox path on a Windows device.
'Find the data path of the Dropbox application
'Reference: https://www.dropbox.com/help/4584
'Requires the Json Library
'Returns Dropbox path as string
'Example Return: DropboxPath: C:\Users\Robert\Dropbox
`Sub FindDropboxPath As String
For Each s As String In Array("APPDATA", "LOCALAPPDATA")
Dim folder As String = GetEnvironmentVariable(s, "")
If folder = "" Then Continue
'Check if info file in json format exists in users folder.
'This is done by first looking for the users roaming folder, like C:\Users\Robert\AppData\Roaming
'Then look into subfolder Dropbox and read content of the info.json file. Example content:
'{"personal": {"path": "C:\\Users\\Robert\\Dropbox", "host": 2643039830}}
If File.Exists(folder, "Dropbox\info.json") Then
Dim parser As JSONParser
parser.Initialize(File.ReadString(folder, "Dropbox\info.json"))
Dim m As Map = parser.NextObject
Dim key As String
'Checks the key, like {"personal": {"path": "C:\\Users\\Robert\\Dropbox", "host": 2643039830}}
If m.ContainsKey("business") Then key = "business" Else key = "personal"
m = m.Get(key)
Return m.Get("path")
End If
Next
Return ""
End Sub`

Changed: , Category: Dropbox, File: T6C187M1359.htm, ID: 1359