Don't expand environment vars when reading .mmg files

Fixes #795.
This commit is contained in:
Moritz Bunkus 2012-11-13 20:22:39 +01:00
parent f2aee381ce
commit 8bf64d26bc
4 changed files with 25 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2012-11-13 Moritz Bunkus <moritz@bunkus.org>
* mmg: bug fix: Fixed reading file names containing a '%' from a
.mmg settings file (both normally saved files and the job queue
files). Fixes #795.
2012-10-08 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: enhancement: Dirac video code: Added four more

View File

@ -178,6 +178,7 @@ mmg_app::OnInit() {
#else
cfg = new wxFileConfig(wxT("mkvmergeGUI"), wxEmptyString, get_config_file_name());
#endif
cfg->SetExpandEnvVars(false);
wxConfigBase::Set(cfg);
init_ui_locale();

View File

@ -380,6 +380,8 @@ mmg_dialog::on_file_new(wxCommandEvent &evt) {
tmp_name.Printf(wxT("%stempsettings-%d.mmg"), get_temp_dir().c_str(), (int)wxGetProcessId());
wxFileConfig cfg(wxT("mkvmerge GUI"), wxT("Moritz Bunkus"), tmp_name);
cfg.SetExpandEnvVars(false);
tc_output->SetValue(wxEmptyString);
input_page->load(&cfg, MMG_CONFIG_FILE_VERSION_MAX);
@ -415,6 +417,8 @@ mmg_dialog::load(wxString file_name,
int version;
wxFileConfig cfg(wxT("mkvmerge GUI"), wxT("Moritz Bunkus"), file_name);
cfg.SetExpandEnvVars(false);
cfg.SetPath(wxT("/mkvmergeGUI"));
if (!cfg.Read(wxT("file_version"), &version) || (1 > version) || (MMG_CONFIG_FILE_VERSION_MAX < version)) {
if (used_for_jobs)
@ -454,20 +458,18 @@ mmg_dialog::on_file_save(wxCommandEvent &) {
void
mmg_dialog::save(wxString file_name,
bool used_for_jobs) {
wxFileConfig *cfg;
wxFileConfig cfg{wxT("mkvmerge GUI"), wxT("Moritz Bunkus"), file_name};
cfg.SetExpandEnvVars(false);
cfg = new wxFileConfig(wxT("mkvmerge GUI"), wxT("Moritz Bunkus"), file_name);
cfg->SetPath(wxT("/mkvmergeGUI"));
cfg->Write(wxT("file_version"), MMG_CONFIG_FILE_VERSION_MAX);
cfg->Write(wxT("gui_version"), wxT(VERSION));
cfg->Write(wxT("output_file_name"), tc_output->GetValue());
cfg->Write(wxT("cli_options"), cli_options);
cfg.SetPath(wxT("/mkvmergeGUI"));
cfg.Write(wxT("file_version"), MMG_CONFIG_FILE_VERSION_MAX);
cfg.Write(wxT("gui_version"), wxT(VERSION));
cfg.Write(wxT("output_file_name"), tc_output->GetValue());
cfg.Write(wxT("cli_options"), cli_options);
input_page->save(cfg);
attachments_page->save(cfg);
global_page->save(cfg);
delete cfg;
input_page->save(&cfg);
attachments_page->save(&cfg);
global_page->save(&cfg);
if (!used_for_jobs) {
set_status_bar(Z("Configuration saved."));

View File

@ -634,7 +634,8 @@ tab_input::insert_file_in_controls(mmg_file_cptr file,
}
}
lb_input_files->Insert(wxString::Format(wxT("%s%s (%s)"), append ? wxT("++> ") : wxEmptyString, file->file_name.AfterLast(wxT(PSEP)).c_str(), file->file_name.BeforeLast(wxT(PSEP)).c_str()), new_file_pos);
wxFileName fn{file->file_name};
lb_input_files->Insert(wxString::Format(wxT("%s%s (%s)"), append ? wxT("++> ") : wxEmptyString, fn.GetFullName().c_str(), fn.GetPath().c_str()), new_file_pos);
files.insert(files.begin() + new_file_pos, file);
@ -1230,9 +1231,8 @@ tab_input::load(wxConfigBase *cfg,
}
if (!fi->tracks.empty()) {
s = fi->file_name.BeforeLast(PSEP);
c = fi->file_name.AfterLast(PSEP);
lb_input_files->Append(wxString::Format(wxT("%s%s (%s)"), fi->appending ? wxT("++> ") : wxEmptyString, c.c_str(), s.c_str()));
wxFileName fn{fi->file_name};
lb_input_files->Append(wxString::Format(wxT("%s%s (%s)"), fi->appending ? wxT("++> ") : wxEmptyString, fn.GetFullName().c_str(), fn.GetPath().c_str()));
files.push_back(fi);
}