From 329a74b1971278d36b4e15983fa4248cc1ccd31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Hellstr=C3=B6m?= Date: Fri, 28 Jan 2022 16:06:52 +0100 Subject: [PATCH] Fix the bug where files where not found using relative paths --- .../Internal/Compiler/SyntaxTreeResolver.cs | 5 +++-- .../Common/Extensions/HostBuilderExtensions.cs | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/AppModel/NetDaemon.AppModel/Internal/Compiler/SyntaxTreeResolver.cs b/src/AppModel/NetDaemon.AppModel/Internal/Compiler/SyntaxTreeResolver.cs index 58d422e50..1c904865c 100644 --- a/src/AppModel/NetDaemon.AppModel/Internal/Compiler/SyntaxTreeResolver.cs +++ b/src/AppModel/NetDaemon.AppModel/Internal/Compiler/SyntaxTreeResolver.cs @@ -17,9 +17,10 @@ IOptions settings public IReadOnlyCollection GetSyntaxTrees() { + var fullPath = Path.GetFullPath(_settings.ApplicationConfigurationFolder); // Get the paths for all .cs files recursively in app folder var csFiles = Directory.EnumerateFiles( - _settings.ApplicationConfigurationFolder, + fullPath, "*.cs", SearchOption.AllDirectories).ToArray(); @@ -32,4 +33,4 @@ public IReadOnlyCollection GetSyntaxTrees() select syntaxTree); return result; } -} \ No newline at end of file +} diff --git a/src/Runtime/NetDaemon.Runtime/Common/Extensions/HostBuilderExtensions.cs b/src/Runtime/NetDaemon.Runtime/Common/Extensions/HostBuilderExtensions.cs index 2064e19f4..6660e62e1 100644 --- a/src/Runtime/NetDaemon.Runtime/Common/Extensions/HostBuilderExtensions.cs +++ b/src/Runtime/NetDaemon.Runtime/Common/Extensions/HostBuilderExtensions.cs @@ -23,8 +23,11 @@ public static IHostBuilder UseNetDaemonAppSettings(this IHostBuilder hostBuilder config.AddEnvironmentVariables(); var c = config.Build(); var locationSetting = c.GetSection("NetDaemon").Get(); + + var fullPath = Path.GetFullPath(locationSetting.ApplicationConfigurationFolder); + config.AddYamlAppConfig( - locationSetting.ApplicationConfigurationFolder); + fullPath); }); } @@ -41,4 +44,4 @@ public static IHostBuilder UseNetDaemonRuntime(this IHostBuilder hostBuilder) services.AddSingleton(); }); } -} \ No newline at end of file +}