set up handling of asset files from the plugin directory

This commit is contained in:
Nils Kruthoff 2026-02-24 11:28:42 +01:00
parent 4819b933e8
commit 93e0fb4842
No known key found for this signature in database
GPG Key ID: A5C0151B4DDB172C
3 changed files with 12 additions and 2 deletions

View File

@ -61,6 +61,10 @@
<ProjectReference Include="..\SourceCodeRules\SourceCodeRules\SourceCodeRules.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>
<ItemGroup>
<Folder Include="Plugins\assistants\assets\" />
</ItemGroup>
<!-- Read the meta data file -->
<Target Name="ReadMetaData" BeforeTargets="BeforeBuild">
<Error Text="The ../../metadata.txt file was not found!" Condition="!Exists('../../metadata.txt')" />

View File

@ -56,6 +56,11 @@ public abstract partial class PluginBase : IPluginMetadata
/// <inheritdoc />
public bool IsInternal { get; }
/// <summary>
/// The absolute path to the plugin directory (where `plugin.lua` lives).
/// </summary>
public string PluginPath { get; internal set; } = string.Empty;
/// <summary>
/// The issues that occurred during the initialization of this plugin.
@ -494,4 +499,4 @@ public abstract partial class PluginBase : IPluginMetadata
}
#endregion
}
}

View File

@ -95,6 +95,7 @@ public static partial class PluginFactory
var code = await File.ReadAllTextAsync(pluginMainFile, Encoding.UTF8, cancellationToken);
var plugin = await Load(meta.LocalPath, code, cancellationToken);
plugin.PluginPath = meta.LocalPath;
if (plugin is NoPlugin noPlugin)
{
LOG.LogError($"Was not able to start plugin: Id='{meta.Id}', Type='{meta.Type}', Name='{meta.Name}', Version='{meta.Version}'. Reason: {noPlugin.Issues.First()}");
@ -119,4 +120,4 @@ public static partial class PluginFactory
LOG.LogError($"Was not able to start plugin: Id='{meta.Id}', Type='{meta.Type}', Name='{meta.Name}', Version='{meta.Version}'. Reasons: {string.Join("; ", plugin.Issues)}");
return new NoPlugin($"Was not able to start plugin: Id='{meta.Id}', Type='{meta.Type}', Name='{meta.Name}', Version='{meta.Version}'. Reasons: {string.Join("; ", plugin.Issues)}");
}
}
}