I need to do something like this:
StreamReader reader =
new System.IO.StreamReader(@"C:\Program Files\The Awesome Program That I Made\awesomeloadablefile.ldf");
Except I don’t know where the user has installed the program. How is my program supposed to know where the installed files are?
I am a noob, in case you hadn’t noticed.
You can use
Assembly.GetEntryAssembly().Locationto get the path on disk of your executable,Path.GetDirectoryNameto get the directory it’s in, and thenPath.Combineto combine the directory name with your file name in that directory. So: