Skip to content

Commit 29a8048

Browse files
committed
fix ResolveConfigPath with Env bug
1 parent 07e706d commit 29a8048

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

build/version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<VersionMajor>4</VersionMajor>
44
<VersionMinor>0</VersionMinor>
5-
<VersionPatch>80</VersionPatch>
5+
<VersionPatch>81</VersionPatch>
66
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionPatch)</VersionPrefix>
77
</PropertyGroup>
88
</Project>

src/SmartSql.DIExtension/SmartSqlDIExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using SmartSql.Configuration;
88
using SmartSql.DbSession;
99
using SmartSql.DIExtension;
10+
using SmartSql.Utils;
1011

1112
namespace Microsoft.Extensions.DependencyInjection
1213
{
@@ -59,7 +60,7 @@ private static string ResolveConfigPath(IServiceProvider sp)
5960
configPath = $"SmartSqlMapConfig.{envStr}.xml";
6061
}
6162

62-
if (!File.Exists(configPath))
63+
if (!ResourceUtil.FileExists(configPath))
6364
{
6465
configPath = SmartSqlBuilder.DEFAULT_SMARTSQL_CONFIG_PATH;
6566
}

src/SmartSql/Utils/ResourceUtil.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ public static XmlDocument LoadAsXml(ResourceType resourceType, string resourcePa
3737
}
3838
}
3939
}
40+
41+
public static bool FileExists(string filePath)
42+
{
43+
if (!File.Exists(filePath))
44+
{
45+
filePath = Path.Combine(BaseDirectory, filePath);
46+
}
47+
48+
return File.Exists(filePath);
49+
}
4050

4151
public static XmlDocument LoadFileAsXml(string filePath)
4252
{

0 commit comments

Comments
 (0)