-2

I'm working on a game and I need the game to sync some character save files to a Dropbox location but it will be different for every computer. What method can I use to find the location and save it to a known location?

for example, mine would be: "C:\Users\Cameron\Dropbox". but for someone else it could be "C:\Users\Russell\Dropbox".

  • You are almost certainly going to have to ask the user to provide that path. By default it normally ends up in the users MyDocuments folder. But that still won't tell you the name. And that's only on Windows. Why would you use Dropbox for that anyway? Is that some sort of method of centralizing the data so they can get to it from other linked machines? Why don't you just keep this stuff in a Database? – durbnpoisn Jun 16 '14 at 19:57
  • @durbnpoisn The Dropbox location is stored in `AppData\Roaming\Dropbox\host.db` – admdrew Jun 16 '14 at 19:58
  • There are a [few](http://superuser.com/questions/177050/how-can-you-find-out-the-location-of-the-my-dropbox-folder) [other](http://stackoverflow.com/questions/9660280/how-do-i-programmatically-locate-my-dropbox-folder-using-c) questions/answers on this topic. – admdrew Jun 16 '14 at 19:59
  • I'm not familiar with centralized servers or databases. I just need the game to be able to save files in a certain location that all the computers linked to a Dropbox "group" can access. – user3746198 Jun 16 '14 at 20:02
  • Ok, like I said... That was just Windows. Yeah, you're going to have to have the user look for the path for their "puplic" or "shared" folder, or whatever you're using, and provide that to your program. – durbnpoisn Jun 16 '14 at 20:05

1 Answers1

0

okay this is what I was looking for:

public void findDropboxFolder() // string dropBoxLocation is a global variable.
{
    string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
    string dbPath = System.IO.Path.Combine(appDataPath, "Dropbox\\host.db");
    string[] lines = System.IO.File.ReadAllLines(dbPath);
    byte[] dbBase64Text = Convert.FromBase64String(lines[1]);
    dropBoxLocation = System.Text.ASCIIEncoding.ASCII.GetString(dbBase64Text);
    MessageBox.Show(dropBoxLocation);
}

thanks for your input.