comdlg32: File dialog: Append multi-part extensions like .abc.def.

This commit is contained in:
Joachim Priesner 2015-06-03 00:14:08 +02:00 committed by Alexandre Julliard
parent ef3ed04cdc
commit c5ad37baf0
2 changed files with 8 additions and 2 deletions

View File

@ -2596,10 +2596,11 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
filterSearchIndex[0] = '\0'; filterSearchIndex[0] = '\0';
} }
/* find the file extension by searching for the first dot in filterExt */
/* strip the * or anything else from the extension, "*.abc" becomes "abc" */ /* strip the * or anything else from the extension, "*.abc" becomes "abc" */
/* if the extension is invalid or contains a glob, ignore it */ /* if the extension is invalid or contains a glob, ignore it */
filterSearchIndex = PathFindExtensionW(filterExt); filterSearchIndex = strchrW(filterExt, '.');
if (*filterSearchIndex++ && !strchrW(filterSearchIndex, '*') && !strchrW(filterSearchIndex, '?')) if (filterSearchIndex++ && !strchrW(filterSearchIndex, '*') && !strchrW(filterSearchIndex, '?'))
{ {
strcpyW(filterExt, filterSearchIndex); strcpyW(filterExt, filterSearchIndex);
} }

View File

@ -1130,6 +1130,11 @@ static void test_extension(void)
for (i = 0; i < ARRAY_SIZE(defext_wildcard_filters); i++) { for (i = 0; i < ARRAY_SIZE(defext_wildcard_filters); i++) {
test_extension_helper(&ofn, defext_wildcard_filters[i], "deadbeef.xyz"); test_extension_helper(&ofn, defext_wildcard_filters[i], "deadbeef.xyz");
} }
/* Append valid extensions consisting of multiple parts */
test_extension_helper(&ofn, "TestFilter (*.abc.def)\0*.abc.def\0", "deadbeef.abc.def");
test_extension_helper(&ofn, "TestFilter (.abc.def)\0.abc.def\0", "deadbeef.abc.def");
test_extension_helper(&ofn, "TestFilter (*.*.def)\0*.*.def\0", "deadbeef.xyz");
} }
#undef ARRAY_SIZE #undef ARRAY_SIZE