[英]How to make CefSharp store cache in [App's startup folder]/Cache?
var settings = new CefSettings();
// Initialize cef with the provided settings
settings.CachePath = "C:/Users/Anoni/Source/Repos/WindowsFormsApp1/bin/Debug/Cache";
Cef.Initialize(settings);
// Create a browser component
chromeBrowser = new ChromiumWebBrowser("https://www.reddit.com/r/Turkishleft/");
// Add it to the form and fill it to the form window.
this.Controls.Add(chromeBrowser);
chromeBrowser.Dock = DockStyle.Fill;
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
settings.RemoteDebuggingPort = 8088;
這些是我的 CefSharp 設置。 如您所見,CefSharp 將我的緩存存儲在“C:/Users/Anoni/Source/Repos/WindowsFormsApp1/bin/Debug/Cache”中。 但我希望它在應用程序開始的任何地方存儲緩存。 例如,如果應用程序從“D:/”開始,我希望它將緩存保存在“D:/Cache”中。 我怎樣才能做到這一點?
找到了。 代碼行應該是
settings.CachePath = Application.StartupPath + "/Cache";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.