Use the full installation path to mkvmerge.exe on Windows.

This commit is contained in:
Moritz Bunkus 2009-04-29 16:38:35 +02:00
parent ce2cb604a5
commit eb02423227
2 changed files with 34 additions and 6 deletions

View File

@ -581,6 +581,18 @@ get_temp_dir() {
return temp_dir;
}
wxString
get_installation_dir() {
wxConfig cfg(wxT("mkvmergeGUI"), wxEmptyString, wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE);
cfg.SetPath(wxT("/GUI"));
wxString path;
if (cfg.Read(wxT("installation_path"), &path))
return path;
return wxT("");
}
wxString
create_track_order(bool all) {
int i;
@ -1129,16 +1141,12 @@ mmg_dialog::display_help(int id) {
bool first;
#if defined(SYS_WINDOWS)
cfg = new wxConfig(wxT("mkvmergeGUI"), wxEmptyString, wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE);
cfg->SetPath(wxT("/GUI"));
if (cfg->Read(wxT("installation_path"), &help_path)) {
help_path = get_installation_dir();
if (!help_path.IsEmpty()) {
help_path += wxT("/doc");
potential_help_paths.push_back(help_path);
}
delete cfg;
#else
// Debian, probably others
potential_help_paths.push_back(wxT("/usr/share/doc/mkvtoolnix"));
@ -2021,6 +2029,25 @@ mmg_dialog::load_preferences() {
cfg->Read(wxU("set_delay_from_filename"), &options.set_delay_from_filename, true);
options.validate();
#if defined(SYS_WINDOWS)
// Check whether or not the mkvmerge executable path is still set to
// the default value "mkvmerge". If it is try getting the
// installation path from the registry and use that for a more
// precise location for mkvmerge.exe. Fall back to the old default
// value "mkvmerge" if all else fails.
if (options.mkvmerge == wxT("mkvmerge"))
options.mkvmerge.Empty();
if (options.mkvmerge.IsEmpty()) {
options.mkvmerge = get_installation_dir();
if (!options.mkvmerge.IsEmpty())
options.mkvmerge += wxT("\\mkvmerge.exe");
}
if (options.mkvmerge.IsEmpty())
options.mkvmerge = wxT("mkvmerge");
#endif // SYS_WINDOWS
}
void

View File

@ -198,6 +198,7 @@ wxString UTFstring_to_wxString(const UTFstring &u);
wxString unescape(const wxString &src);
wxString format_date_time(time_t date_time);
wxString get_temp_dir();
wxString get_installation_dir();
wxString create_track_order(bool all);