In the following code, I am trying to get a folder location from the user. However, when I selected E:\ in the folder browser, szAbsolutePath doesn’t give me the path for the CD burner temporary folder. This prevents me from saving to this location. However, if I choose something like E:\folder1\, I get the full path and can write out files to this location.
char szDisplayName[MAX_PATH];
BROWSEINFO binfo;
memset(&binfo, 0, sizeof(BROWSEINFO));
binfo.lpszTitle = strTitle.c_str();
binfo.hwndOwner = hwndOwner;
binfo.pszDisplayName = szDisplayName;
binfo.ulFlags = BIF_USENEWUI | BIF_NEWDIALOGSTYLE | BIF_BROWSEFILEJUNCTIONS | BIF_RETURNONLYFSDIRS;
PIDLIST_ABSOLUTE pidl = SHBrowseForFolder(&binfo);
if(pidl) {
char szAbsolutePath[MAX_PATH];
SHGetPathFromIDList(pidl, szAbsolutePath);
}
How can I always get the full path when the user chooses the root of the CD-R drive?
You can use the
ICDBurn::GetRecorderDriveLetterfunction to get the recorder’s drive letter – then it’s trivial to compare against the string you get back fromGetSaveFileName(). If you do get back a path on the CD burner, you can useSHGetFolderLocationwithCSIDL_CDBURN_AREAto get the path of the staging area – then it’s simply a matter of replacing the drive letter at the beginning of the path string with the path of the staging area.