Moved hardcoded WebView2 path from "C:\RSL" to the application's current directory

Changed the WebView2 cache directory from system root path "C:\RSL" to the application's current directory for improved portability and reliability. Ensured the cache directory is created before initializing the WebView2 environment
This commit is contained in:
jp64k
2026-01-07 20:16:44 +01:00
parent a050d82c8b
commit 7cc437309a

View File

@@ -439,7 +439,7 @@ namespace AndroidSideloader
{
try
{
string webViewDirectoryPath = Path.Combine(Path.GetPathRoot(Environment.SystemDirectory), "RSL", "EBWebView");
string webViewDirectoryPath = Path.Combine(Environment.CurrentDirectory, "WebView2Cache");
if (Directory.Exists(webViewDirectoryPath))
{
FileSystemUtilities.TryDeleteDirectory(webViewDirectoryPath);
@@ -5460,7 +5460,8 @@ CTRL + F4 - Instantly relaunch Rookie Sideloader");
try
{
var appDataFolder = Path.Combine(Path.GetPathRoot(Environment.SystemDirectory), "RSL");
var appDataFolder = Path.Combine(Environment.CurrentDirectory, "WebView2Cache");
Directory.CreateDirectory(appDataFolder); // Ensure it exists
var env = await CoreWebView2Environment.CreateAsync(userDataFolder: appDataFolder);
await webView21.EnsureCoreWebView2Async(env);