Skip to content

Commit

Permalink
Use Workspace directory for usedata directory
Browse files Browse the repository at this point in the history
With this contribution, Edge browser uses the workspace directory for
the userdata directory for the separation of the usage of userdata
directory per workspace by the webview2Environment.

contributes to #1013
  • Loading branch information
amartya4256 authored and HeikoKlare committed Oct 28, 2024
1 parent 69d16e9 commit c211330
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Edge extends WebBrowser {
*/
private static final URI URI_FOR_CUSTOM_TEXT_PAGE = setupAndGetLocationForCustomTextPage();
private static final String ABOUT_BLANK = "about:blank";
private static final String DISPLAY_USER_DATA_FOLDER = "displayUserDataFolder";

private record WebViewEnvironment(ICoreWebView2Environment environment, ArrayList<Edge> instances) {
public WebViewEnvironment(ICoreWebView2Environment environment) {
Expand Down Expand Up @@ -476,6 +477,9 @@ WebViewEnvironment createEnvironment() {
String dataDir = System.getProperty(DATA_DIR_PROP);
String browserArgs = System.getProperty(BROWSER_ARGS_PROP);
String language = System.getProperty(LANGUAGE_PROP);
if (dataDir == null) {
dataDir = (String) browser.getDisplay().getData(DISPLAY_USER_DATA_FOLDER);
}
if (dataDir == null) {
// WebView2 will append "\\EBWebView"
dataDir = (String)display.getData(APPLOCAL_DIR_KEY);
Expand Down

0 comments on commit c211330

Please sign in to comment.