mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 11:54:01 +00:00
Fixed initialization. Also made sure that stdio is only redirected once as the CL args are passed multiple times.
This commit is contained in:
parent
141fa9974e
commit
fcb91df81c
@ -52,11 +52,12 @@ bool
|
|||||||
mi_app::OnInit() {
|
mi_app::OnInit() {
|
||||||
string initial_file;
|
string initial_file;
|
||||||
vector<string> args;
|
vector<string> args;
|
||||||
|
|
||||||
|
setup();
|
||||||
|
|
||||||
#if WXUNICODE
|
#if WXUNICODE
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
init_mm_stdio();
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
args.push_back(string(wxMB(wxString(argv[i]))));
|
args.push_back(string(wxMB(wxString(argv[i]))));
|
||||||
#else
|
#else
|
||||||
|
@ -259,6 +259,7 @@ _show_element(EbmlElement *l,
|
|||||||
void
|
void
|
||||||
parse_args(vector<string> args,
|
parse_args(vector<string> args,
|
||||||
string &file_name) {
|
string &file_name) {
|
||||||
|
static bool stdio_redirected = false;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
verbose = 0;
|
verbose = 0;
|
||||||
@ -294,9 +295,11 @@ parse_args(vector<string> args,
|
|||||||
if ((i + 1) == args.size())
|
if ((i + 1) == args.size())
|
||||||
mxerror("'%s' is missing the file name.\n", args[i].c_str());
|
mxerror("'%s' is missing the file name.\n", args[i].c_str());
|
||||||
try {
|
try {
|
||||||
set_mm_stdio(new mm_file_io_c(args[i + 1], MODE_CREATE));
|
if (!stdio_redirected)
|
||||||
|
set_mm_stdio(new mm_file_io_c(args[i + 1], MODE_CREATE));
|
||||||
|
stdio_redirected = true;
|
||||||
++i;
|
++i;
|
||||||
} catch(...) {
|
} catch(mm_io_open_error_c &e) {
|
||||||
mxerror("Could not open the file '%s' for directing the output.\n",
|
mxerror("Could not open the file '%s' for directing the output.\n",
|
||||||
args[i + 1].c_str());
|
args[i + 1].c_str());
|
||||||
}
|
}
|
||||||
@ -2032,7 +2035,8 @@ console_main(vector<string> args) {
|
|||||||
int
|
int
|
||||||
main(int argc,
|
main(int argc,
|
||||||
char **argv) {
|
char **argv) {
|
||||||
init_mm_stdio();
|
setup();
|
||||||
|
|
||||||
return console_main(command_line_utf8(argc, argv));
|
return console_main(command_line_utf8(argc, argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user