What do you think about this version?
Better, but still not correct: + ret = DlgDirSelectExA( WIN_Handle32(hwnd), buffer, MAX_PATH, id ); + if (GetLastError() == 0) GetShortPathNameA(buffer, str, len);
You shouldn't check GetLastError() for whether DlgDirSelectExA succeeded. Rather, just check ret. You have the same problem in DlgDirSelectComboBoxEx16. --Juan
Juan Lang escribió:
What do you think about this version?
Better, but still not correct:
- ret = DlgDirSelectExA( WIN_Handle32(hwnd), buffer, MAX_PATH, id );
- if (GetLastError() == 0) GetShortPathNameA(buffer, str, len);
You shouldn't check GetLastError() for whether DlgDirSelectExA succeeded. Rather, just check ret. You have the same problem in DlgDirSelectComboBoxEx16. --Juan
Sorry, but I have to object. According to the documentation in MSDN, DlgDirSelectExA returns nonzero when the current selection is a directory name, and zero when it is not. However, plain filenames do not qualify as directory names, so DlgDirSelectExA won't return nonzero on them either. I checked on wine's implementation just to be sure. So checking ret will not tell apart a case of failure from a case of a plain filename being returned. That is why I need to zero out the last error and check against it after return.
Sorry, but I have to object. According to the documentation in MSDN, DlgDirSelectExA returns nonzero when the current selection is a directory name, and zero when it is not.
Ah, right you are. Thanks for correcting me. Objection withdrawn. --Juan
Alex Villacís Lasso a_villacis@palosanto.com writes:
Sorry, but I have to object. According to the documentation in MSDN, DlgDirSelectExA returns nonzero when the current selection is a directory name, and zero when it is not. However, plain filenames do not qualify as directory names, so DlgDirSelectExA won't return nonzero on them either. I checked on wine's implementation just to be sure. So checking ret will not tell apart a case of failure from a case of a plain filename being returned. That is why I need to zero out the last error and check against it after return.
That still won't work, because our implementation doesn't set last error on failure. Maybe it should, but that will require some test cases.