I'm using Managed C++.
I need to extract the parent directory after OpenFileDialog returns the String^ file path.
System::String^ filestring = openFileDialog1->FileName;
The method that microsoft uses is Directory::GetParent
but this must be saved as
System::IO::DirectoryInfo^ WhyIsThisNotAString = Directory::GetParent(filestring)
I need to somehow convert from DirectoryInfo^
to String^
.
I have also tried this after OpenFileDialog is called, but it does not work:
String^ CurrDir = Directory::GetCurrentDirectory();
Or if there is a better way to extract the parent directory that would be great.
Thanks