mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 10:19:07 +00:00
Fix WebView2 data path
This commit is contained in:
@@ -19,7 +19,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using Microsoft.Web.WebView2.Wpf;
|
|
||||||
using QuickLook.Common.Plugin;
|
using QuickLook.Common.Plugin;
|
||||||
|
|
||||||
namespace QuickLook.Plugin.HtmlViewer
|
namespace QuickLook.Plugin.HtmlViewer
|
||||||
@@ -35,8 +34,6 @@ namespace QuickLook.Plugin.HtmlViewer
|
|||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
if (Helper.IsWebView2Available())
|
|
||||||
new WebView2().EnsureCoreWebView2Async();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanHandle(string path)
|
public bool CanHandle(string path)
|
||||||
|
@@ -39,7 +39,13 @@ namespace QuickLook.Plugin.HtmlViewer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_webView = new WebView2();
|
_webView = new WebView2
|
||||||
|
{
|
||||||
|
CreationProperties = new CoreWebView2CreationProperties
|
||||||
|
{
|
||||||
|
UserDataFolder = Path.Combine(App.LocalDataPath, @"WebView2_Data\\")
|
||||||
|
}
|
||||||
|
};
|
||||||
_webView.NavigationStarting += NavigationStarting_CancelNavigation;
|
_webView.NavigationStarting += NavigationStarting_CancelNavigation;
|
||||||
Content = _webView;
|
Content = _webView;
|
||||||
}
|
}
|
||||||
|
@@ -32,6 +32,7 @@ namespace QuickLook
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
|
public static readonly string LocalDataPath = SettingHelper.LocalDataPath;
|
||||||
public static readonly string UserPluginPath = Path.Combine(SettingHelper.LocalDataPath, "QuickLook.Plugin\\");
|
public static readonly string UserPluginPath = Path.Combine(SettingHelper.LocalDataPath, "QuickLook.Plugin\\");
|
||||||
public static readonly string AppFullPath = Assembly.GetExecutingAssembly().Location;
|
public static readonly string AppFullPath = Assembly.GetExecutingAssembly().Location;
|
||||||
public static readonly string AppPath = Path.GetDirectoryName(AppFullPath);
|
public static readonly string AppPath = Path.GetDirectoryName(AppFullPath);
|
||||||
|
Reference in New Issue
Block a user