From 6b84c3ee86ab16483ad87c70c2e1087a286f7b48 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 16 Apr 2013 20:02:28 +0200 Subject: [PATCH] mmg: handle all command line arguments (e.g. add all files) Fixes #867. --- ChangeLog | 5 +++++ src/mmg/mmg.cpp | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c3869c4a..46ac186ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2013-04-16 Moritz Bunkus + * mmg: bug fix: mmg will now handle all file names given on the + command line instead of only the first one. This allows things + like opening several selected files with mmg in Windows, and mmg + will add all of them. Fixes #867. + * mkvmerge: bug fix: The amount of memory required to store the cues during muxing has been reduced drastically. This is more noticeable the more video and subtitle tracks are muxed. Fixes diff --git a/src/mmg/mmg.cpp b/src/mmg/mmg.cpp index c6c1765b6..dbf0914eb 100644 --- a/src/mmg/mmg.cpp +++ b/src/mmg/mmg.cpp @@ -243,23 +243,23 @@ mmg_app::handle_command_line_arguments() { return; } - wxString file = wargs[0]; - if (!wxFileExists(file) || wxDirExists(file)) - wxMessageBox(wxString::Format(Z("The file '%s' does not exist."), file.c_str()), Z("Error loading settings"), wxOK | wxCENTER | wxICON_ERROR); - else { + for (auto &file : wargs) + if (!wxFileExists(file) || wxDirExists(file)) + wxMessageBox(wxString::Format(Z("The file '%s' does not exist."), file.c_str()), Z("Error loading settings"), wxOK | wxCENTER | wxICON_ERROR); + else { #ifdef SYS_WINDOWS - if ((file.Length() > 3) && (file.c_str()[1] != wxT(':')) && (file.c_str()[0] != wxT('\\'))) - file = wxGetCwd() + wxT("\\") + file; + if ((file.Length() > 3) && (file.c_str()[1] != wxT(':')) && (file.c_str()[0] != wxT('\\'))) + file = wxGetCwd() + wxT("\\") + file; #else - if ((file.Length() > 0) && (file.c_str()[0] != wxT('/'))) - file = wxGetCwd() + wxT("/") + file; + if ((file.Length() > 0) && (file.c_str()[0] != wxT('/'))) + file = wxGetCwd() + wxT("/") + file; #endif - if (wxFileName(file).GetExt() == wxU("mmg")) - mdlg->load(file); - else - mdlg->input_page->add_file(file, false); - } + if (wxFileName(file).GetExt() == wxU("mmg")) + mdlg->load(file); + else + mdlg->input_page->add_file(file, false); + } } int