This is a simple form with four buttons that will launch four programs. All four programs are related to each other and reside in the same directory.
I've been struggling on porting this program from C++ to C# and one of the major issues was getting WorkingDirectory to function. I have finally sorted that nuisance out. However, what I need now is to prompt the user (on program load) to select the directory of the four aforementioned executables my program should look for.
Here's some code for one of the buttons (there are three others exactly like it with only minor changes obviously):
private void button1_Click(object sender, EventArgs e)
{
string myDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string gameDir = Path.Combine(myDir, "PATH TO BE SPECIFIED BY USER");
string gameExe = Path.Combine(gameDir, "Proc1.EXE");
Process proc1 = new Process();
proc1.StartInfo.FileName = gameExe;
proc1.StartInfo.WorkingDirectory = gameDir;
proc1.SynchronizingObject = this;
proc1.EnableRaisingEvents = true;
proc1.Start();
}
Line 4 "PATH TO BE SPECIFIED BY USER" is where the user's directory would be located.
Now, if I were to hard code the directory that's on my machine, it works flawlessly. The problem will arise when users have these 4 executables installed to a different directory than I.
What I'm afraid is going to happen is my program would need to rely on external configuration files for this to work. I admit, I'm very, very new to programming and wouldn't even know where to begin with that.
I hope I've explained my problem enough. if not, please let me know. Thanks for your help!