Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: use custom user data dir for updater WebView2#138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deansheather merged 1 commit intomainfromdean/updater-webview-fix
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletionsApp/App.csproj
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,6 +17,8 @@
<LangVersion>preview</LangVersion>
<!-- We have our own implementation of main with exception handling -->
<DefineConstants>DISABLE_XAML_GENERATED_MAIN;DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION</DefineConstants>
<!-- Default version for debug builds, overridden during releases -->
<Version>0.1.0.0</Version>

<AssemblyName>Coder Desktop</AssemblyName>
<AssemblyTitle>Coder Desktop</AssemblyTitle>
Expand Down
16 changes: 14 additions & 2 deletionsApp/ViewModels/UpdaterUpdateAvailableViewModel.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,10 +4,12 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Coder.Desktop.App.Services;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.Extensions.Logging;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.Web.WebView2.Core;
using NetSparkleUpdater;
using NetSparkleUpdater.Enums;
using NetSparkleUpdater.Events;
Expand DownExpand Up@@ -174,8 +176,18 @@ public async Task Changelog_Loaded(object sender, RoutedEventArgs e)
if (sender is not WebView2 webView)
return;

// Start the engine.
await webView.EnsureCoreWebView2Async();
// Start the engine with a custom user data folder. The default for
// unpackaged WinUI 3 apps is to write to a subfolder in the app's
// install directory, which is Program Files by default and not
// writeable by the user.
var userDataFolder = Path.Join(SettingsManagerUtils.AppSettingsDirectory(), "WebView2");
_logger.LogDebug("Creating WebView2 user data folder at {UserDataFolder}", userDataFolder);
Directory.CreateDirectory(userDataFolder);
var env = await CoreWebView2Environment.CreateWithOptionsAsync(
null,
userDataFolder,
new CoreWebView2EnvironmentOptions());
await webView.EnsureCoreWebView2Async(env);

// Disable unwanted features.
var settings = webView.CoreWebView2.Settings;
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp