Handle temp paths with spaces.

This commit is contained in:
Moritz Bunkus 2005-03-13 17:47:27 +00:00
parent da6d33e0a7
commit d5388dfb95
4 changed files with 25 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2005-03-13 Moritz Bunkus <moritz@bunkus.org>
* mmg: bug fix: If the TEMP environment variable contains spaces
then the calls to mkvmerge when adding files failed.
2005-03-06 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Extracting the FPS from some AVC MP4 files

View File

@ -155,8 +155,10 @@ job_run_dialog::start_next_job() {
mdlg->load(wxString::Format(wxT("%s/jobs/%d.mmg"), wxGetCwd().c_str(),
jobs[ndx].id));
opt_file_name.Printf(wxT("mmg-mkvmerge-options-%d-%d"),
opt_file_name.Printf(wxT("%smmg-mkvmerge-options-%d-%d"),
get_temp_dir().c_str(),
(int)wxGetProcessId(), (int)time(NULL));
try {
opt_file = new wxFile(opt_file_name, wxFile::write);
} catch (...) {
@ -191,8 +193,8 @@ job_run_dialog::start_next_job() {
process = new wxProcess(this, 1);
process->Redirect();
pid = wxExecute((*arg_list)[0] + wxT(" @") + opt_file_name, wxEXEC_ASYNC,
process);
pid = wxExecute((*arg_list)[0] + wxT(" \"@") + opt_file_name + wxT("\""),
wxEXEC_ASYNC, process);
out = process->GetInputStream();
*jobs[ndx].log = wxT("");

View File

@ -144,8 +144,8 @@ mux_dialog::mux_dialog(wxWindow *parent):
}
delete opt_file;
pid = wxExecute((*arg_list)[0] + wxT(" @") + opt_file_name, wxEXEC_ASYNC,
process);
pid = wxExecute((*arg_list)[0] + wxT(" \"@") + opt_file_name + wxT("\""),
wxEXEC_ASYNC, process);
out = process->GetInputStream();
line = "";

View File

@ -764,7 +764,7 @@ tab_input::add_file(const wxString &file_name,
wxUCS(strerror(errno)));
wxMessageBox(error, wxT("File creation failed"), wxOK | wxCENTER |
wxICON_ERROR);
throw 0;
return;
}
opt_file->Write(wxT("--output-charset\nUTF-8\n--identify-verbose\n"));
arg_utf8 = to_utf8(file_name);
@ -772,8 +772,19 @@ tab_input::add_file(const wxString &file_name,
opt_file->Write(wxT("\n"));
delete opt_file;
command = wxT("\"") + mkvmerge_path + wxT("\" @") + opt_file_name;
command = wxT("\"") + mkvmerge_path + wxT("\" \"@") + opt_file_name +
wxT("\"");
wxLogMessage(wxT("identify 1: command: ``%s''"), command.c_str());
result = wxExecute(command, output, errors);
wxLogMessage(wxT("identify 1: result: %d"), result);
for (i = 0; i < output.Count(); i++)
wxLogMessage(wxT("identify 1: output[%d]: ``%s''"), i, output[i].c_str());
for (i = 0; i < errors.Count(); i++)
wxLogMessage(wxT("identify 1: errors[%d]: ``%s''"), i, errors[i].c_str());
wxRemoveFile(opt_file_name);
if ((result < 0) || (result > 1)) {
name.Printf(wxT("File identification failed for '%s'. Return code: "