浏览代码

updater: Clear shader cache after updating

(cherry picked from commit cfd8d4c993ba2b6d61541b66a8d08ed436de824d)
derrod 1 年之前
父节点
当前提交
08052b340e
共有 1 个文件被更改,包括 16 次插入0 次删除
  1. 16 0
      UI/win-update/updater/updater.cpp

+ 16 - 0
UI/win-update/updater/updater.cpp

@@ -1298,6 +1298,16 @@ static void UpdateRegistryVersion(const Manifest &manifest)
 	RegCloseKey(key);
 	RegCloseKey(key);
 }
 }
 
 
+static void ClearShaderCache()
+{
+	wchar_t shader_path[MAX_PATH];
+	SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT,
+			 shader_path);
+	StringCbCatW(shader_path, sizeof(shader_path),
+		     L"\\obs-studio\\shader-cache");
+	filesystem::remove_all(shader_path);
+}
+
 extern "C" void UpdateHookFiles(void);
 extern "C" void UpdateHookFiles(void);
 
 
 static bool Update(wchar_t *cmdLine)
 static bool Update(wchar_t *cmdLine)
@@ -1700,6 +1710,12 @@ static bool Update(wchar_t *cmdLine)
 	Status(L"Updating Game Capture hooks...");
 	Status(L"Updating Game Capture hooks...");
 	UpdateHookFiles();
 	UpdateHookFiles();
 
 
+	/* ------------------------------------- *
+	 * Clear shader cache                    */
+
+	Status(L"Clearing shader cache...");
+	ClearShaderCache();
+
 	/* ------------------------------------- *
 	/* ------------------------------------- *
 	 * Update installed version in registry  */
 	 * Update installed version in registry  */