query windows registry for xjadeo & harvid path
authorRobin Gareus <robin@gareus.org>
Thu, 24 Apr 2014 00:08:19 +0000 (02:08 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 24 Apr 2014 00:08:19 +0000 (02:08 +0200)
gtk2_ardour/video_server_dialog.cc
gtk2_ardour/video_timeline.cc

index bc9e8be4420096af983318b44178ecda399eb3dd..f9a50821b54527580c05281ac446788b04b38e1d 100644 (file)
@@ -83,10 +83,24 @@ 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];
+#endif
+
        std::string icsd_file_path;
        if (find_file_in_search_path (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<LPBYTE>(tmp), &size))
+                       )
+       {
+               path_entry.set_text(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "harvid.exe", 0));
+       }
+#endif
        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"));
        }
index ea66a621e45ba4aa5e087f256eef293bd498b059..0ef0f4c5d853cc0c590b38477d79800f0a0131b2 100644 (file)
@@ -716,14 +716,36 @@ VideoTimeLine::set_video_server_docroot(std::string vsr) {
 void
 VideoTimeLine::find_xjadeo () {
        std::string xjadeo_file_path;
+#ifdef PLATFORM_WINDOWS
+       HKEY key;
+       DWORD size = PATH_MAX;
+       char tmp[PATH_MAX+1];
+#endif
        if (getenv("XJREMOTE")) {
                _xjadeo_bin = getenv("XJREMOTE");
        } else if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
                _xjadeo_bin = xjadeo_file_path;
        }
+#ifdef PLATFORM_WINDOWS
+       /* old xjadeo, typo in key <= 0.7.6 */
+       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSSxjadeo", 0, KEY_READ, &key))
+                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
+                       )
+       {
+               _xjadeo_bin = std::string(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "xjadeo.exe", 0));
+       }
+       else if ( (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\RSS\\xjadeo", 0, KEY_READ, &key))
+                       &&  (ERROR_SUCCESS == RegQueryValueExA (key, "Install_Dir", 0, NULL, reinterpret_cast<LPBYTE>(tmp), &size))
+                       )
+       {
+               _xjadeo_bin = std::string(g_build_filename(Glib::locale_to_utf8(tmp).c_str(), "xjadeo.exe", 0));
+       }
+#endif
+#ifdef __APPLE__
        else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
                _xjadeo_bin = X_("/Applications/Jadeo.app/Contents/MacOS/xjremote");
        }
+#endif
        else if (Glib::file_test(X_("C:\\Program Files\\xjadeo\\xjadeo.exe"), Glib::FILE_TEST_EXISTS)) {
                _xjadeo_bin = X_("C:\\Program Files\\xjadeo\\xjadeo.exe");
        }