Handle the cases when initdir is either invalid, or specifies a file.
This commit is contained in:
parent
d0779463da
commit
be4aff376b
|
@ -1159,10 +1159,15 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
|
|||
DWORD result;
|
||||
|
||||
strcpyW(tmpBuf, fodInfos->initdir);
|
||||
if( PathFileExistsW(tmpBuf) ) {
|
||||
/* initdir does not have to be a directory. If a file is
|
||||
* specified, the dir part is taken */
|
||||
if( PathIsDirectoryW(tmpBuf)) {
|
||||
if (tmpBuf[strlenW(tmpBuf)-1] != '\\') {
|
||||
strcatW(tmpBuf, szwSlash);
|
||||
}
|
||||
strcatW(tmpBuf, szwStar);
|
||||
}
|
||||
result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit);
|
||||
if (result) {
|
||||
*nameBit = 0x00;
|
||||
|
@ -1174,6 +1179,13 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
|
|||
TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir));
|
||||
}
|
||||
}
|
||||
else if (fodInfos->initdir)
|
||||
{
|
||||
MemFree(fodInfos->initdir);
|
||||
fodInfos->initdir = NULL;
|
||||
TRACE("Value in InitDir is not an existing path, changed to (nil)\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((handledPath == FALSE) && ((fodInfos->initdir==NULL) ||
|
||||
|
|
Loading…
Reference in New Issue