Would anybody know how to do this:
I'm making a program that allows the user to select an initial directory so that when the program starts up again next time they use it the default folder for saving will be the one in the txt file. For example.
@"C:\Program Files\Steam\SteamApps\<username>@<emaildomain>\cou nter-strike\hl.exe";
so what this does is they browse the the hl.exe file and then it saves the Path.GetDirectoryName() of it, but what i really want is i want it to save only the path to the <username>@<emaildoamin>and no subdirectories afterward, so that the text file would look like this:
since the folder varies throughout users and there are no files in <username>@<emaildomain>, only folders.
so as a summary i just want the user to be able to browse to hl.exe and then have the path go backwards two folders.
when you put the name of the filein your program write the path
not only the name
if you want another solution
make a shortcut in the defaut directory ...
Never mind, i figured it out:
OpenFileDialog dlg= new OpenFileDialog();
dlg.Filter="Half-Life exe (*.exe)|*.exe";
const string _directpath=@"C:\Documents and settings\all users\BSP Config\";
textBox3.Text = parent.FullName;
DirectoryInfo dir= Directory.CreateDirectory(_directpath);
StreamWriter file=new StreamWriter(@"C:\Documents and settings\all users\BSP config\steam.cfg");