From 8e5f83f139ed6876b13a0993c62b50830a339d70 Mon Sep 17 00:00:00 2001 From: dgeibi Date: Tue, 12 Jan 2021 11:49:50 +0800 Subject: [PATCH] Register obsstudio URL handler for windows --- UI/installer/mp-installer.nsi | 10 ++++++++++ UI/platform-windows.cpp | 5 ++++- UI/platform.hpp | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/UI/installer/mp-installer.nsi b/UI/installer/mp-installer.nsi index c4af1e3d2afe74..48bbbd9a2975d3 100644 --- a/UI/installer/mp-installer.nsi +++ b/UI/installer/mp-installer.nsi @@ -390,6 +390,15 @@ Section -FinishSection WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "OBS Project" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "HelpLink" "https://obsproject.com" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${APPVERSION}" + WriteRegStr HKCR "obsstudio" "" "URL:OBS Studio" + WriteRegStr HKCR "obsstudio" "URL Protocol" "" + !ifdef INSTALL64 + WriteRegStr HKCR "obsstudio\shell\open\command" "" '"$INSTDIR\bin\64bit\obs64.exe"' + WriteRegStr HKCR "obsstudio\DefaultIcon" "" "$INSTDIR\bin\64bit\obs64.exe" + !else + WriteRegStr HKCR "obsstudio\shell\open\command" "" '"$INSTDIR\bin\32bit\obs32.exe"' + WriteRegStr HKCR "obsstudio\DefaultIcon" "" "$INSTDIR\bin\32bit\obs32.exe" + !endif SectionEnd @@ -429,6 +438,7 @@ Section "un.obs-studio Program Files" UninstallSection1 ; Remove from registry... DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" DeleteRegKey HKLM "SOFTWARE\${APPNAME}" + DeleteRegKey HKCR "obsstudio" ; Delete self Delete "$INSTDIR\uninstall.exe" diff --git a/UI/platform-windows.cpp b/UI/platform-windows.cpp index 61ac6bc82b2e65..4498e3faaed77b 100644 --- a/UI/platform-windows.cpp +++ b/UI/platform-windows.cpp @@ -61,7 +61,10 @@ bool GetDataFilePath(const char *data, string &output) bool InitApplicationBundle() { - return true; + char *pathptr = os_get_executable_path_ptr(NULL); + int ret = os_chdir(pathptr); + bfree(pathptr); + return ret == 0; } string GetDefaultVideoSavePath() diff --git a/UI/platform.hpp b/UI/platform.hpp index 7e7d47ed1041bb..a6f7178b4f1734 100644 --- a/UI/platform.hpp +++ b/UI/platform.hpp @@ -27,7 +27,7 @@ class QWidget; /* Gets the path of obs-studio specific data files (such as locale) */ bool GetDataFilePath(const char *data, std::string &path); -/* Updates the working directory for OSX application bundles */ +/* Updates the working directory for OSX application bundles or Windows */ bool InitApplicationBundle(); std::string GetDefaultVideoSavePath();