STAR TREK 2d20
Page 1 of 3 123 Last
  1. #1

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096

    Registry entry for application data

    FG has the ability to redirect the data folder away from windows default appdata. What registry entry should I look in to find that location? I'm trying to write a tool that works external to FG but needs access to data folder.

  2. #2
    HKEY_CURRENT_USER\Software\Fantasy Grounds\2.0\DataDir

  3. #3

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Thanks

  4. #4

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    I am a Mac guy, and I'm getting an error in my C# program that attempts to start Fantasy Grounds. This is my code line giving the error:

    Process.Start(@"C:\Program Files x86\Fantasy Grounds II\FantasyGrounds.exe");

    This gives me the following Fantasy Grounds error:

    FG Error.png

    I do not get an error of any kind when I start FG from the windows start menu.

    I went to file explorer to see if there was some kind of command that should be included in the exe line, but the properties of the start menu item did not show any such thing.

    Dulux, or some windows guru, can you tell me please what I am doing wrong?

  5. #5

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    My first guess would be that it's running the executable in the wrong directory.

  6. #6

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    That's what I'm thinking, too, Andraax, but I'm a Windows retard, and I can't figure out what else I need to do before that .Start call to get things set up correctly. (Pretty sure it is using my program's path as some kind of default directory).

  7. #7

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    Find what the "default directory" is for the entry in the start directory (probably something like "C:\Program Files x86\Fantasy Grounds II") and change to that directory before running it.

    I'm not a C# programmer, but I found this sample online using a specified working directory with Process.Start:

    ProcessStartInfo _processStartInfo = new ProcessStartInfo();
    _processStartInfo.WorkingDirectory = @"%ProgramFiles%";
    _processStartInfo.FileName = @"Notepad.exe";
    _processStartInfo.Arguments = "test.txt";
    _processStartInfo.CreateNoWindow = true;
    Process myProcess = Process.Start(_processStartInfo);

  8. #8

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    I found that directory using the registry entry that gamerhawaii located (and now I know how to use RegEdit to go look in that file). Thanks for the tip on creating the process instance. I was going to try SetCurrentDirectory, but I think what you have is actually the ticket. I will let you know how it goes. Thanks, Andraax.

  9. #9

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    3,096
    Well, that didn't work either. Here is my code:

    Code:
                ProcessStartInfo fgRunner = new ProcessStartInfo();
                fgRunner.WorkingDirectory = @"c:\Users\AppData\Roaming\Fantasy Grounds II";
                fgRunner.FileName = myFile;
                fgRunner.UseShellExecute = false;
                try
                {
                    Process myProcess = Process.Start(fgRunner);
                }
                catch (Exception er)
                {
                    MessageBox.Show("Unable to start Fantasy Grounds." + "\r\t(" + er.GetType().ToString() + er.Data + ": " + er.Message + ")", "Error", MessageBoxButtons.OK);
                    return false;
                }
    I know hard-coding the directory is a bad practice, and I intend to get that from the registry once I get this working, but right now, when my code runs, FG tries to start, but it issues the same message from my post #4 above.

  10. #10

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    I doubt that "c:\Users\AppData\Roaming\Fantasy Grounds II" is the directory where your executable is installed. More than likely it's "C:\Program Files x86\Fantasy Grounds II".

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in