I'm using a folderBrowseDialog to give the user the ability to choose where the program is going to save some files. there is a problem that the user can choose path that the application can not manipulate, for instance "c:\" (the program is launched by user not admin)
I've seen some program that propose me change my path to "my documents" whenever I try to choose a path that USER cannot manipulate, however I could not figure out how to do it. note that I'm using folderBrowseDialog not savefiledialog.
So I thought that maybe I'll pop a warning, using the FileIOPermission. but for some reasone it doesn't work. here is a quick code I wrote, but the exception is never thrown. FileIOPremission on MSDN
using namespace System::Security::Permissions;
FileIOPermission^ f2 = gcnew FileIOPermission( FileIOPermissionAccess::Write,"C:\\");
try {
f2->Demand();
}
catch (System::Security::SecurityException^ s){
MessageBox::Show(s->Message);
}