File extension for new configs or hard disc images is now appended if user doesn't specify one.

This commit is contained in:
SarahW 2017-05-16 21:20:21 +01:00
commit c518e3d137
4 changed files with 5 additions and 4 deletions

View file

@ -102,7 +102,7 @@ static BOOL CALLBACK config_selection_dlgproc(HWND hdlg, UINT message, WPARAM wP
strcat(s, "configs\\"); strcat(s, "configs\\");
pclog("Dir %s\n", s); pclog("Dir %s\n", s);
if (!getsfile(hdlg, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", "", s)) if (!getsfile(hdlg, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", "", s, "cfg"))
{ {
config_open(hdlg); config_open(hdlg);

View file

@ -205,7 +205,7 @@ static BOOL CALLBACK hdnew_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARA
return TRUE; return TRUE;
case IDC_CFILE: case IDC_CFILE:
if (!getsfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "", NULL)) if (!getsfile(hdlg, "Hard disc image (*.IMG)\0*.IMG\0All files (*.*)\0*.*\0", "", NULL, "img"))
{ {
h = GetDlgItem(hdlg, IDC_EDITC); h = GetDlgItem(hdlg, IDC_EDITC);
SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring); SendMessage(h, WM_SETTEXT, 0, (LPARAM)openfilestring);

View file

@ -818,7 +818,7 @@ int getfile(HWND hwnd, char *f, char *fn)
return 1; return 1;
} }
int getsfile(HWND hwnd, char *f, char *fn, char *dir) int getsfile(HWND hwnd, char *f, char *fn, char *dir, char *ext)
{ {
OPENFILENAME ofn; // common dialog box structure OPENFILENAME ofn; // common dialog box structure
BOOL r; BOOL r;
@ -842,6 +842,7 @@ int getsfile(HWND hwnd, char *f, char *fn, char *dir)
ofn.nMaxFileTitle = 0; ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = dir; ofn.lpstrInitialDir = dir;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
ofn.lpstrDefExt = ext;
// Display the Open dialog box. // Display the Open dialog box.

View file

@ -34,7 +34,7 @@ void joystickconfig_open(HWND hwnd, int joy_nr, int type);
extern char openfilestring[260]; extern char openfilestring[260];
int getfile(HWND hwnd, char *f, char *fn); int getfile(HWND hwnd, char *f, char *fn);
int getsfile(HWND hwnd, char *f, char *fn, char *dir); int getsfile(HWND hwnd, char *f, char *fn, char *dir, char *ext);
extern int pause; extern int pause;