@@ -14,11 +14,13 @@ namespace BootstrapBlazor.Server.Services;
1414/// <param name="factory"></param>
1515/// <param name="cacheManager"></param>
1616/// <param name="options"></param>
17+ /// <param name="configuration"></param>
1718/// <param name="localizerOptions"></param>
1819class CodeSnippetService (
1920 IHttpClientFactory factory ,
2021 ICacheManager cacheManager ,
2122 IOptions < WebsiteOptions > options ,
23+ IConfiguration configuration ,
2224 IOptions < JsonLocalizationOptions > localizerOptions )
2325{
2426 /// <summary>
@@ -88,7 +90,7 @@ private async Task<string> ReadFileAsync(string fileName)
8890 string ? payload ;
8991 var file = options . Value . IsDevelopment
9092 ? $ "{ options . Value . ContentRootPath } \\ ..\\ BootstrapBlazor.Server\\ Components\\ Samples\\ { fileName } "
91- : $ "{ options . Value . SourceCodePath } BootstrapBlazor.Server\\ Components\\ Samples\\ { fileName } ";
93+ : $ "{ GetSourceCodePath ( ) } BootstrapBlazor.Server\\ Components\\ Samples\\ { fileName } ";
9294 if ( ! OperatingSystem . IsWindows ( ) )
9395 {
9496 file = file . Replace ( '\\ ' , '/' ) ;
@@ -104,6 +106,8 @@ private async Task<string> ReadFileAsync(string fileName)
104106 return payload ;
105107 }
106108
109+ private string GetSourceCodePath ( ) => $ "{ configuration . GetValue < string > ( "SourceCodePath" ) ?? options . Value . SourceCodePath } ";
110+
107111 private static string ReplaceSymbols ( string payload ) => payload
108112 . Replace ( "@@" , "@" )
109113 . Replace ( "<" , "<" )
0 commit comments