Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
38603c4c
Commit
38603c4c
authored
Jul 14, 2004
by
Krishna Murthy
Committed by
Alexandre Julliard
Jul 14, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the selected extension from file type filter if file name does not
contain the file extension.
parent
0b072cb6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
22 deletions
+35
-22
filedlg.c
dlls/commdlg/filedlg.c
+35
-22
No files found.
dlls/commdlg/filedlg.c
View file @
38603c4c
...
...
@@ -1871,35 +1871,48 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
case
ONOPEN_OPEN
:
/* fill in the return struct and close the dialog */
TRACE
(
"ONOPEN_OPEN %s
\n
"
,
debugstr_w
(
lpstrPathAndFile
));
{
WCHAR
*
ext
=
NULL
;
/* update READONLY check box flag */
if
((
SendMessageA
(
GetDlgItem
(
hwnd
,
IDC_OPENREADONLY
),
BM_GETCHECK
,
0
,
0
)
&
0x03
)
==
BST_CHECKED
)
fodInfos
->
ofnInfos
->
Flags
|=
OFN_READONLY
;
else
fodInfos
->
ofnInfos
->
Flags
&=
~
OFN_READONLY
;
/* add default extension */
if
(
fodInfos
->
defext
)
{
WCHAR
*
ext
=
PathFindExtensionW
(
lpstrPathAndFile
);
if
(
!
*
ext
)
{
/* only add "." in case a default extension does exist */
if
(
*
fodInfos
->
defext
!=
'\0'
)
{
static
const
WCHAR
szwDot
[]
=
{
'.'
,
0
};
int
PathLength
=
strlenW
(
lpstrPathAndFile
);
strcatW
(
lpstrPathAndFile
,
szwDot
);
strcatW
(
lpstrPathAndFile
,
fodInfos
->
defext
);
/* In Open dialog: if file does not exist try without extension */
if
(
!
(
fodInfos
->
DlgInfos
.
dwDlgProp
&
FODPROP_SAVEDLG
)
&&
!
PathFileExistsW
(
lpstrPathAndFile
))
lpstrPathAndFile
[
PathLength
]
=
'\0'
;
}
}
/* Attach the file extension with file name*/
ext
=
PathFindExtensionW
(
lpstrPathAndFile
);
if
(
!
*
ext
)
{
/* if no extension is specified with file name, then */
/* attach the extension from file filter or default one */
WCHAR
*
filterExt
=
NULL
;
LPWSTR
lpstrFilter
=
NULL
;
static
const
WCHAR
szwDot
[]
=
{
'.'
,
0
};
int
PathLength
=
strlenW
(
lpstrPathAndFile
);
/* Attach the dot*/
strcatW
(
lpstrPathAndFile
,
szwDot
);
/*Get the file extension from file type filter*/
lpstrFilter
=
(
LPWSTR
)
CBGetItemDataPtr
(
fodInfos
->
DlgInfos
.
hwndFileTypeCB
,
fodInfos
->
ofnInfos
->
nFilterIndex
-
1
);
if
(
lpstrFilter
!=
(
LPWSTR
)
CB_ERR
)
/* control is not empty */
filterExt
=
PathFindExtensionW
(
lpstrFilter
);
if
(
*
filterExt
)
/* attach the file extension from file type filter*/
strcatW
(
lpstrPathAndFile
,
filterExt
+
1
);
else
if
(
fodInfos
->
defext
)
/* attach the default file extension*/
strcatW
(
lpstrPathAndFile
,
fodInfos
->
defext
);
/* In Open dialog: if file does not exist try without extension */
if
(
!
(
fodInfos
->
DlgInfos
.
dwDlgProp
&
FODPROP_SAVEDLG
)
&&
!
PathFileExistsW
(
lpstrPathAndFile
))
lpstrPathAndFile
[
PathLength
]
=
'\0'
;
}
if
(
fodInfos
->
defext
)
/* add default extension */
{
/* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
if
(
*
ext
)
ext
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment