1
0
Fork 0

God forgive me: Escaping { from file path for init

This commit is contained in:
foralost 2023-11-26 11:02:05 +01:00
parent 570aaea06d
commit 16fccbd2d4
2 changed files with 5 additions and 3 deletions

View File

@ -1248,7 +1248,7 @@ void MainWindow::openFileSlot()
void MainWindow::openRecentFileSlot(QString filename)
{
DbgCmdExec(QString().sprintf("init \"%s\"", filename.toUtf8().constData()));
DbgCmdExec(QString().sprintf("init \"%s\"", DbgCmdEscape(filename).toUtf8().constData()));
}
void MainWindow::runSlot()
@ -1263,7 +1263,7 @@ void MainWindow::restartDebugging()
{
auto last = mMRUList->getEntry(0);
if(!last.isEmpty())
DbgCmdExec(QString("init \"%1\"").arg(last));
DbgCmdExec(QString("init \"%1\"").arg(DbgCmdEscape(last)));
}
void MainWindow::displayBreakpointWidget()
@ -1281,10 +1281,11 @@ void MainWindow::dragEnterEvent(QDragEnterEvent* pEvent)
void MainWindow::dropEvent(QDropEvent* pEvent)
{
if(pEvent->mimeData()->hasUrls())
{
QString filename = QDir::toNativeSeparators(pEvent->mimeData()->urls()[0].toLocalFile());
DbgCmdExec(QString().sprintf("init \"%s\"", filename.toUtf8().constData()));
DbgCmdExec(QString().sprintf("init \"%s\"", DbgCmdEscape(filename).toUtf8().constData()));
pEvent->acceptProposedAction();
}
}

View File

@ -295,6 +295,7 @@ QString DbgCmdEscape(QString argument)
{
// TODO: implement this properly
argument.replace("\"", "\\\"");
argument.replace("{", "\\{");
return argument;
}