The Add Hard Disk and New Floppy Image dialogs now automatically append an extension to the file name when none was given by the user.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Handle the New Floppy Image dialog.
|
* Handle the New Floppy Image dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_new_floppy.c 1.0.4 2018/03/06
|
* Version: @(#)win_new_floppy.c 1.0.5 2018/03/19
|
||||||
*
|
*
|
||||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -556,6 +556,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
int ret;
|
int ret;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int zip_types;
|
int zip_types;
|
||||||
|
wchar_t *twcs;
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
@@ -624,6 +625,21 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case IDC_CFILE:
|
case IDC_CFILE:
|
||||||
if (!file_dlg_w(hdlg, plat_get_string(is_zip ? IDS_2176 : IDS_2174), L"", 1)) {
|
if (!file_dlg_w(hdlg, plat_get_string(is_zip ? IDS_2176 : IDS_2174), L"", 1)) {
|
||||||
|
if (!wcschr(wopenfilestring, L'.')) {
|
||||||
|
if (wcslen(wopenfilestring) && (wcslen(wopenfilestring) <= 256)) {
|
||||||
|
twcs = &wopenfilestring[wcslen(wopenfilestring)];
|
||||||
|
twcs[0] = L'.';
|
||||||
|
if (!is_zip && (filterindex == 3)) {
|
||||||
|
twcs[1] = L'8';
|
||||||
|
twcs[2] = L'6';
|
||||||
|
twcs[3] = L'f';
|
||||||
|
} else {
|
||||||
|
twcs[1] = L'i';
|
||||||
|
twcs[2] = L'm';
|
||||||
|
twcs[3] = L'g';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
h = GetDlgItem(hdlg, IDC_EDIT_FILE_NAME);
|
h = GetDlgItem(hdlg, IDC_EDIT_FILE_NAME);
|
||||||
f = _wfopen(wopenfilestring, L"rb");
|
f = _wfopen(wopenfilestring, L"rb");
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Windows 86Box Settings dialog handler.
|
* Windows 86Box Settings dialog handler.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings.c 1.0.44 2018/03/18
|
* Version: @(#)win_settings.c 1.0.45 2018/03/19
|
||||||
*
|
*
|
||||||
* Author: Miran Grca, <mgrca8@gmail.com>
|
* Author: Miran Grca, <mgrca8@gmail.com>
|
||||||
*
|
*
|
||||||
@@ -2740,6 +2740,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
|
|||||||
uint64_t r = 0;
|
uint64_t r = 0;
|
||||||
uint8_t channel = 0;
|
uint8_t channel = 0;
|
||||||
uint8_t id = 0, lun = 0;
|
uint8_t id = 0, lun = 0;
|
||||||
|
wchar_t *twcs;
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
@@ -3056,6 +3057,16 @@ hd_add_ok_common:
|
|||||||
case IDC_CFILE:
|
case IDC_CFILE:
|
||||||
if (!file_dlg_w(hdlg, plat_get_string(IDS_4106), L"", !(existing & 1)))
|
if (!file_dlg_w(hdlg, plat_get_string(IDS_4106), L"", !(existing & 1)))
|
||||||
{
|
{
|
||||||
|
if (!wcschr(wopenfilestring, L'.')) {
|
||||||
|
if (wcslen(wopenfilestring) && (wcslen(wopenfilestring) <= 256)) {
|
||||||
|
twcs = &wopenfilestring[wcslen(wopenfilestring)];
|
||||||
|
twcs[0] = L'.';
|
||||||
|
twcs[1] = L'i';
|
||||||
|
twcs[2] = L'm';
|
||||||
|
twcs[3] = L'g';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(existing & 1))
|
if (!(existing & 1))
|
||||||
{
|
{
|
||||||
f = _wfopen(wopenfilestring, L"rb");
|
f = _wfopen(wopenfilestring, L"rb");
|
||||||
|
|||||||
Reference in New Issue
Block a user