Skip to content

Commit

Permalink
Updater hotfixes
Browse files Browse the repository at this point in the history
- Fixed missing CefSharp.dll required file (even when not using CefSharp
- Updater creates missing dll files (needed to exist, but don't need data in them)
  • Loading branch information
TCNOco committed Nov 20, 2021
1 parent 8518da5 commit 5351df0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TcNo-Acc-Switcher-Client/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private static void InitializeChromium()
/// </summary>
private static void CheckCefFiles()
{
string[] cefFiles = { "libcef.dll", "icudtl.dat", "resources.pak", "libGLESv2.dll", "d3dcompiler_47.dll", "vk_swiftshader.dll", "CefSharp.dll", "chrome_elf.dll", "CefSharp.BrowserSubprocess.Core.dll" };
string[] cefFiles = { "libcef.dll", "icudtl.dat", "resources.pak", "libGLESv2.dll", "d3dcompiler_47.dll", "vk_swiftshader.dll", "chrome_elf.dll", "CefSharp.BrowserSubprocess.Core.dll" };
foreach (var cefFile in cefFiles)
{
var path = Path.Join(Globals.AppDataFolder, "runtimes\\win-x64\\native\\", cefFile);
Expand Down
3 changes: 0 additions & 3 deletions TcNo-Acc-Switcher-Client/PostBuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ move TcNo-Acc-Switcher\runtimes\win-x64\native\resources.pak CEF\resources.pak
move TcNo-Acc-Switcher\runtimes\win-x64\native\libGLESv2.dll CEF\libGLESv2.dll
move TcNo-Acc-Switcher\runtimes\win-x64\native\d3dcompiler_47.dll CEF\d3dcompiler_47.dll
move TcNo-Acc-Switcher\runtimes\win-x64\native\vk_swiftshader.dll CEF\vk_swiftshader.dll
move TcNo-Acc-Switcher\runtimes\win-x64\native\CefSharp.dll CEF\CefSharp.dll
move TcNo-Acc-Switcher\runtimes\win-x64\native\chrome_elf.dll CEF\chrome_elf.dll
move TcNo-Acc-Switcher\runtimes\win-x64\native\CefSharp.BrowserSubprocess.Core.dll CEF\CefSharp.BrowserSubprocess.Core.dll

Expand All @@ -158,7 +157,6 @@ break > TcNo-Acc-Switcher\runtimes\win-x64\native\resources.pak
break > TcNo-Acc-Switcher\runtimes\win-x64\native\libGLESv2.dll
break > TcNo-Acc-Switcher\runtimes\win-x64\native\d3dcompiler_47.dll
break > TcNo-Acc-Switcher\runtimes\win-x64\native\vk_swiftshader.dll
break > TcNo-Acc-Switcher\runtimes\win-x64\native\CefSharp.dll
break > TcNo-Acc-Switcher\runtimes\win-x64\native\chrome_elf.dll
break > TcNo-Acc-Switcher\runtimes\win-x64\native\CefSharp.BrowserSubprocess.Core.dll

Expand All @@ -184,7 +182,6 @@ copy /b/v/y CEF\resources.pak TcNo-Acc-Switcher\runtimes\win-x64\native\resource
copy /b/v/y CEF\libGLESv2.dll TcNo-Acc-Switcher\runtimes\win-x64\native\libGLESv2.dll
copy /b/v/y CEF\d3dcompiler_47.dll TcNo-Acc-Switcher\runtimes\win-x64\native\d3dcompiler_47.dll
copy /b/v/y CEF\vk_swiftshader.dll TcNo-Acc-Switcher\runtimes\win-x64\native\vk_swiftshader.dll
copy /b/v/y CEF\CefSharp.dll TcNo-Acc-Switcher\runtimes\win-x64\native\CefSharp.dll
copy /b/v/y CEF\chrome_elf.dll TcNo-Acc-Switcher\runtimes\win-x64\native\chrome_elf.dll
copy /b/v/y CEF\CefSharp.BrowserSubprocess.Core.dll TcNo-Acc-Switcher\runtimes\win-x64\native\CefSharp.BrowserSubprocess.Core.dll

Expand Down
14 changes: 12 additions & 2 deletions TcNo-Acc-Switcher-Updater/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,11 @@ private void VerifyFiles()
{
var key = oKey;
if (key.StartsWith("updater")) continue; // Ignore own files >> Otherwise IOException
if (key.StartsWith("runtimes") && IsCefFile(key) && _mainBrowser != "CEF") continue;// Ignore CEF files if not using CEF
if (key.StartsWith("runtimes") && IsCefFile(key))
{
if (!File.Exists(key)) File.Create(key).Dispose(); // Create empty file
if (_mainBrowser != "CEF") continue; // Ignore CEF files if not using CEF
}
cur++;
UpdateProgress(cur * 100 / verifyDictTotal);
if (!File.Exists(key))
Expand Down Expand Up @@ -1114,8 +1118,14 @@ private void ApplyPatches(string oldFolder, string outputFolder)

// Check if part of CEF, and skip if CEF not selected:
if (relativePath.StartsWith("runtimes") && IsCefFile(p))
{
if (!File.Exists(p)) {
File.Create(p).Dispose(); // Create empty file
continue;
}
if (_mainBrowser != "CEF")
continue;
}

var patchedFile = Path.Join(outputFolder, "patched", relativePath);
_ = Directory.CreateDirectory(Path.GetDirectoryName(patchedFile)!);
Expand All @@ -1124,7 +1134,7 @@ private void ApplyPatches(string oldFolder, string outputFolder)
}

private static readonly string[] CefFiles = {
"libcef.dll", "icudtl.dat", "resources.pak", "libGLESv2.dll", "d3dcompiler_47.dll", "vk_swiftshader.dll", "CefSharp.dll", "chrome_elf.dll", "CefSharp.BrowserSubprocess.Core.dll"
"libcef.dll", "icudtl.dat", "resources.pak", "libGLESv2.dll", "d3dcompiler_47.dll", "vk_swiftshader.dll", "chrome_elf.dll", "CefSharp.BrowserSubprocess.Core.dll"
};
private static bool IsCefFile(string file) => CefFiles.Any(file.Contains);

Expand Down

0 comments on commit 5351df0

Please sign in to comment.