Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
cyq1162 committed Nov 14, 2020
1 parent a7d5072 commit 52c996b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Action/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,17 +350,21 @@ public static string WebRootPath
_WebRootPath = value;
}
}
private static bool _IsWeb = false;
internal static bool IsWeb
{
get
{
bool isWeb = HttpContext.Current != null;
if (!isWeb)
if (!_IsWeb)
{
string[] files = Directory.GetFiles(AppConst.AssemblyPath, "*.exe", SearchOption.TopDirectoryOnly);
return files == null || files.Length == 0;
_IsWeb = HttpContext.Current != null || File.Exists(AppDomain.CurrentDomain.BaseDirectory + "web.config");
if (!_IsWeb)
{
string[] files = Directory.GetFiles(AppConst.AssemblyPath, "*.exe", SearchOption.TopDirectoryOnly);
_IsWeb = files == null || files.Length == 0;
}
}
return isWeb;
return _IsWeb;
}
}
internal static Uri WebUri
Expand All @@ -383,6 +387,10 @@ public static bool IsAspNetCore
{
get
{
if (!_IsAspNetCore)
{
_IsAspNetCore = File.Exists(AppConst.AssemblyPath + "appsettings.json");
}
return _IsAspNetCore;
}
set
Expand Down

0 comments on commit 52c996b

Please sign in to comment.