mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-07-19 13:54:44 -04:00
update win32 error codes source handling
This commit is contained in:
@@ -35,8 +35,8 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="..\win32_error_codes.txt" />
|
||||
<AdditionalFiles Include="..\win32_error_codes.txt" />
|
||||
<None Remove="..\win32_error_codes*.txt" />
|
||||
<AdditionalFiles Include="..\win32_error_codes*.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DSharpPlus" Version="4.3.0-nightly-01189" />
|
||||
|
||||
@@ -29,13 +29,15 @@ public class Win32ErrorsSourceGenerator : ISourceGenerator
|
||||
|
||||
public void Execute(GeneratorExecutionContext context)
|
||||
{
|
||||
var resourceName = context.AdditionalFiles.FirstOrDefault(f => Path.GetFileName(f.Path).Equals("win32_error_codes.txt"));
|
||||
var resourceName = context.AdditionalFiles
|
||||
.OrderBy(f => f.Path, StringComparer.OrdinalIgnoreCase)
|
||||
.LastOrDefault(f => Path.GetFileName(f.Path) is string fname && fname.StartsWith("win32_error_codes") && fname.EndsWith(".txt"));
|
||||
if (resourceName is null)
|
||||
return;
|
||||
throw new InvalidOperationException("Failed to locate win32_error_codes txt file");
|
||||
|
||||
using var stream = File.Open(resourceName.Path, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
if (stream is null)
|
||||
throw new InvalidOperationException("Failed to get win32_error_codes.txt stream");
|
||||
throw new InvalidOperationException("Failed to get win32_error_codes txt stream");
|
||||
|
||||
if (!context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.RootNamespace", out var ns))
|
||||
ns = context.Compilation.AssemblyName;
|
||||
|
||||
Reference in New Issue
Block a user