mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 11:51:09 +08:00
Merge pull request #5430 from maron2000/fix_quote
Fix adding quotes to filenames for IMGMOUNT
This commit is contained in:
commit
a94669ea4f
@ -25,6 +25,7 @@
|
||||
#include "dosbox.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <regex>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include <algorithm>
|
||||
@ -680,21 +681,15 @@ void MenuBrowseImageFile(char drive, bool arc, bool boot, bool multiple) {
|
||||
const char *lFilterPatterns[] = {"*.ima","*.img","*.vhd","*.fdi","*.hdi","*.nfd","*.nhd","*.d88","*.hdm","*.xdf","*.iso","*.cue","*.bin","*.chd","*.mdf","*.gog","*.ins","*.ccd","*.inst","*.IMA","*.IMG","*.VHD","*.FDI","*.HDI","*.NFD","*.NHD","*.D88","*.HDM","*.XDF","*.ISO","*.CUE","*.BIN","*.CHD","*.MDF","*.GOG","*.INS","*.CCD","*.INST"};
|
||||
const char *lFilterDescription = "Disk/CD image files";
|
||||
lTheOpenFileName = tinyfd_openFileDialog(((multiple?"Select image file(s) for Drive ":"Select an image file for Drive ")+str+":").c_str(),"", sizeof(lFilterPatterns) / sizeof(lFilterPatterns[0]),lFilterPatterns,lFilterDescription,multiple?1:0);
|
||||
if (lTheOpenFileName) fname = GetNewStr(lTheOpenFileName);
|
||||
if (lTheOpenFileName) fname = "\"" + GetNewStr(lTheOpenFileName) + "\"";
|
||||
if (multiple&&fname.size()) {
|
||||
files += "\"";
|
||||
for (size_t i=0; i<fname.size(); i++)
|
||||
files += fname[i]=='|'?"\" \"":std::string(1,fname[i]);
|
||||
files += "\" ";
|
||||
files = std::regex_replace(fname, std::regex("\\|"), "\" \"");
|
||||
}
|
||||
while (multiple&&lTheOpenFileName&&systemmessagebox("Mount image files","Do you want to mount more image file(s)?","yesno", "question", 1)) {
|
||||
lTheOpenFileName = tinyfd_openFileDialog(("Select image file(s) for Drive "+str+":").c_str(),"", sizeof(lFilterPatterns) / sizeof(lFilterPatterns[0]),lFilterPatterns,lFilterDescription,multiple?1:0);
|
||||
if (lTheOpenFileName) {
|
||||
fname = GetNewStr(lTheOpenFileName);
|
||||
files += "\"";
|
||||
for (size_t i=0; i<fname.size(); i++)
|
||||
files += fname[i]=='|'?"\" \"":std::string(1,fname[i]);
|
||||
files += "\" ";
|
||||
fname = "\"" + GetNewStr(lTheOpenFileName) + "\"";
|
||||
files = files + " " + std::regex_replace(fname, std::regex("\\|"), "\" \"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -723,9 +718,9 @@ void MenuBrowseImageFile(char drive, bool arc, bool boot, bool multiple) {
|
||||
temp_str[0]=drive;
|
||||
temp_str[1]=' ';
|
||||
strcat(mountstring,temp_str);
|
||||
if (!multiple) strcat(mountstring,"\"");
|
||||
//if (!multiple) strcat(mountstring,"\"");
|
||||
strcat(mountstring,files.size()?files.c_str():fname.c_str());
|
||||
if(!multiple) strcat(mountstring, "\"");
|
||||
//if(!multiple) strcat(mountstring, "\"");
|
||||
if(mountiro[drive - 'A']) strcat(mountstring, " -ro");
|
||||
if(boot) {
|
||||
strcat(mountstring, " -u");
|
||||
|
@ -1085,12 +1085,16 @@ bool warn_on_mem_write = false;
|
||||
|
||||
bool systemmessagebox(char const * aTitle, char const * aMessage, char const * aDialogType, char const * aIconType, int aDefaultButton) {
|
||||
#if !defined(HX_DOS)
|
||||
if(!aMessage) aMessage = "";
|
||||
std::string lDialogString(aMessage);
|
||||
std::replace(lDialogString.begin(), lDialogString.end(), '\"', ' ');
|
||||
|
||||
bool fs=sdl.desktop.fullscreen;
|
||||
if (fs) GFX_SwitchFullScreen();
|
||||
MAPPER_ReleaseAllKeys();
|
||||
GFX_LosingFocus();
|
||||
GFX_ReleaseMouse();
|
||||
bool ret=tinyfd_messageBox(aTitle, aMessage, aDialogType, aIconType, aDefaultButton);
|
||||
bool ret=tinyfd_messageBox(aTitle, lDialogString.c_str(), aDialogType, aIconType, aDefaultButton);
|
||||
MAPPER_ReleaseAllKeys();
|
||||
GFX_LosingFocus();
|
||||
if (fs&&!sdl.desktop.fullscreen) GFX_SwitchFullScreen();
|
||||
|
Loading…
x
Reference in New Issue
Block a user