Skip to content

Commit d6a3c50

Browse files
PreciousNyasuluEilonjonathanpeppers
authored
fix: Use AppContext.BaseDirectory instead of Environment.CurrentDirectory (#21797)
#21750 --------- Co-authored-by: Eilon Lipton <[email protected]> Co-authored-by: Jonathan Peppers <[email protected]>
1 parent a7aeade commit d6a3c50

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/BlazorWebView/src/WindowsForms/BlazorWebView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private void StartWebViewCoreIfPossible()
177177
}
178178
else
179179
{
180-
appRootDir = Environment.CurrentDirectory;
180+
appRootDir = AppContext.BaseDirectory;
181181
}
182182
var hostPageFullPath = Path.GetFullPath(Path.Combine(appRootDir, HostPage!)); // HostPage is nonnull because RequiredStartupPropertiesSet is checked above
183183
var contentRootDirFullPath = Path.GetDirectoryName(hostPageFullPath)!;

src/BlazorWebView/src/Wpf/BlazorWebView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ private void StartWebViewCoreIfPossible()
262262
}
263263
else
264264
{
265-
appRootDir = Environment.CurrentDirectory;
265+
appRootDir = AppContext.BaseDirectory;
266266
}
267267
var hostPageFullPath = Path.GetFullPath(Path.Combine(appRootDir, HostPage));
268268
var contentRootDirFullPath = Path.GetDirectoryName(hostPageFullPath)!;

0 commit comments

Comments
 (0)