@@ -14,11 +14,13 @@ namespace BootstrapBlazor.Server.Services;
14
14
/// <param name="factory"></param>
15
15
/// <param name="cacheManager"></param>
16
16
/// <param name="options"></param>
17
+ /// <param name="configuration"></param>
17
18
/// <param name="localizerOptions"></param>
18
19
class CodeSnippetService (
19
20
IHttpClientFactory factory ,
20
21
ICacheManager cacheManager ,
21
22
IOptions < WebsiteOptions > options ,
23
+ IConfiguration configuration ,
22
24
IOptions < JsonLocalizationOptions > localizerOptions )
23
25
{
24
26
/// <summary>
@@ -88,7 +90,7 @@ private async Task<string> ReadFileAsync(string fileName)
88
90
string ? payload ;
89
91
var file = options . Value . IsDevelopment
90
92
? $ "{ options . Value . ContentRootPath } \\ ..\\ BootstrapBlazor.Server\\ Components\\ Samples\\ { fileName } "
91
- : $ "{ options . Value . SourceCodePath } BootstrapBlazor.Server\\ Components\\ Samples\\ { fileName } ";
93
+ : $ "{ GetSourceCodePath ( ) } BootstrapBlazor.Server\\ Components\\ Samples\\ { fileName } ";
92
94
if ( ! OperatingSystem . IsWindows ( ) )
93
95
{
94
96
file = file . Replace ( '\\ ' , '/' ) ;
@@ -104,6 +106,8 @@ private async Task<string> ReadFileAsync(string fileName)
104
106
return payload ;
105
107
}
106
108
109
+ private string GetSourceCodePath ( ) => $ "{ configuration . GetValue < string > ( "SourceCodePath" ) ?? options . Value . SourceCodePath } ";
110
+
107
111
private static string ReplaceSymbols ( string payload ) => payload
108
112
. Replace ( "@@" , "@" )
109
113
. Replace ( "<" , "<" )
0 commit comments