webview / webview

Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows).

Home Page:https://webview.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: enable to specify userdata path in ctor of webview::webview

TsXor opened this issue · comments

What OS are you using (uname -a, or Windows version)?

Windows 22H2

What programming language are you using (C/C++/Go/Rust)?

>gcc --version
gcc.exe (x86_64-posix-seh-rev2, Built by MinGW-W64 project) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

What did you expect to see and what you saw instead?

I wanted to specify userdata path in windows, so I located the call to CreateCoreWebView2EnvironmentWithOptions in webview.
Sadly, I found that the userdata path was hardcoded to %APPDATA%\[program executable name].
I think an optional parameter that specify userdata path can be added to webview::webview::webview(bool debug = false, void *wnd = nullptr) in windows. Or at least provide a function to get where userdata went so that I can delete it on request or use some symlink magic.
Not clear about Linux or MacOS backend, but they should have an option to specify userdata path?

Here is my commit to enable to specify userdata path on Windows: TsXor@52dc59e
I only modified the Windows part, which is not enough for a PR, so I put it here.

Thanks for sharing!