I want to create a file in (drive letter):\Program Files\myprog\file.ext where (drive letter) is the drive letter where windows is installed (or the default drive). Is there an easy Windows API method to retrieve it?
Thanks
PS, here is what I'm currently using:
string mainDrive = "";
foreach (string drive in Directory.GetLogicalDrives())
{
Console.WriteLine(drive);
if (Directory.Exists(drive + "WINDOWS\\System32") || Directory.Exists(drive + "WINDOWS NT\\System32"))
{
mainDrive = drive;
break;
}
}
if (mainDrive.Equals(""))
{
// couldn't find default directory, should probably do some error checking
mainDrive = "C:\\";
}