Hi.
I've found that OpenFileDialog.InitialDirectory doesn't seem to do anything at all in windows 7. Whether you set it or not, it simply opens my documents. Someone else I know has also had the issue (And was unable to resolve it), so I don't think it's just me.
Here's the code I have been using, including the code to get the path to open.
I'm running the windows 7 rtm off of msdn (With the sha-1 hash matching, etc), and I'm coding with .net 3.5 sp1. Thanks.
I've found that OpenFileDialog.InitialDirectory doesn't seem to do anything at all in windows 7. Whether you set it or not, it simply opens my documents. Someone else I know has also had the issue (And was unable to resolve it), so I don't think it's just me.
Here's the code I have been using, including the code to get the path to open.
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.CheckFileExists = true;
openFileDialog.Filter = "VPK files (*.vpk)|*.vpk";
try{
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Valve\\Steam");
string path = (string) key.GetValue("SteamPath");
if (path != ""){
path += "\\steamapps\\common\\left 4 dead\\left4dead";
if (System.IO.Directory.Exists(path))
openFileDialog.InitialDirectory = path;
}
}
catch{
// no steam path found, or there's no copy of left 4 dead in the steam installation.<br/>
}
if
(openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK){
return;
}
// rest of code
I'm running the windows 7 rtm off of msdn (With the sha-1 hash matching, etc), and I'm coding with .net 3.5 sp1. Thanks.