X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fvideo_server_dialog.cc;h=4b3bf206e4dcc7e980b66c056e1b36bccca996c2;hb=5fef65538040fbac1b9edd1847a269aa925a49c9;hp=bc9e8be4420096af983318b44178ecda399eb3dd;hpb=2ba58dfe65bb0c5ba7d5eb18a1566fa79eeb6993;p=ardour.git diff --git a/gtk2_ardour/video_server_dialog.cc b/gtk2_ardour/video_server_dialog.cc index bc9e8be442..4b3bf206e4 100644 --- a/gtk2_ardour/video_server_dialog.cc +++ b/gtk2_ardour/video_server_dialog.cc @@ -29,6 +29,12 @@ #include "ardour/template_utils.h" #include "ardour/session.h" +#ifdef PLATFORM_WINDOWS +#include +#include // CSIDL_* +#include "pbd/windows_special_dirs.h" +#endif + #ifdef interface #undef interface #endif @@ -37,6 +43,10 @@ #include "utils_videotl.h" #include "i18n.h" +#ifdef PLATFORM_WINDOWS +#include +#endif + using namespace Gtk; using namespace std; using namespace PBD; @@ -83,18 +93,49 @@ VideoServerDialog::VideoServerDialog (Session* s) listenaddr_combo.append_text("0.0.0.0"); listenaddr_combo.set_active(0); +#ifdef PLATFORM_WINDOWS + HKEY key; + DWORD size = PATH_MAX; + char tmp[PATH_MAX+1]; + const char *program_files = PBD::get_win_special_folder (CSIDL_PROGRAM_FILES); +#endif + std::string icsd_file_path; - if (find_file_in_search_path (PBD::Searchpath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) { + if (find_file (PBD::Searchpath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) { path_entry.set_text(icsd_file_path); } +#ifdef PLATFORM_WINDOWS + else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ, &key)) + && (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast(tmp), &size)) + ) + { + path_entry.set_text(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "harvid.exe", NULL)); + } + else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\harvid", 0, KEY_READ | KEY_WOW64_32KEY, &key)) + && (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast(tmp), &size)) + ) + { + path_entry.set_text(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "harvid.exe", NULL)); + } + else if (program_files && Glib::file_test(g_build_filename(program_files, "harvid", "harvid.exe", NULL), Glib::FILE_TEST_EXISTS)) + { + path_entry.set_text(g_build_filename(program_files, "harvid", "harvid.exe", NULL)); + } +#endif + /* generic fallbacks to try */ else if (Glib::file_test(X_("C:\\Program Files\\harvid\\harvid.exe"), Glib::FILE_TEST_EXISTS)) { path_entry.set_text(X_("C:\\Program Files\\harvid\\harvid.exe")); } else { PBD::warning << string_compose( - _("The external video server 'harvid' can not be found. The tool is included with the %1 releases from ardour.org, " - "alternatively you can download it from http://x42.github.com/harvid/ or acquire it from your distribution."), PROGRAM_NAME) + _("The external video server 'harvid' can not be found.\n" + "The tool is included with the %1 releases from ardour.org, " + "alternatively you can download it from http://x42.github.com/harvid/ " + "or acquire it from your distribution.\n" + "\n" + "see also http://manual.ardour.org/video-timeline/setup/" + ), PROGRAM_NAME) << endmsg; }