繁体   English   中英

如何让 CefSharp 在 [App 的启动文件夹]/Cache 中存储缓存?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM