Skip to content

Commit e053c6c

Browse files
committed
Add option to override pregenerated symbols path
Introduces the --pregen-sym command option to allow specifying a custom path for the pregenerated.symbols.json file in both LibraryGenerator and ModuleTweaker MainCommand classes. This provides more flexibility for symbol file management.
1 parent af90917 commit e053c6c

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

LibraryGenerator/Commands/MainCommand.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class MainCommand : ICommand
2222
[CommandOption("platform", 'p', Description = "Target platform for symbol generation (e.g., win-client, win-server).", IsRequired = false)]
2323
public string Platform { get; set; } = "win-client";
2424

25+
[CommandOption("pregen-sym", Description = "Overrides the default pregenerated.symbols.json file folder.")]
26+
public string? PregeneratedSymbolsPath { get; set; }
27+
2528
public ValueTask ExecuteAsync(IConsole console)
2629
{
2730
if (!PlatformUtility.TryParse(Platform, out PlatformType PlatformType))
@@ -79,7 +82,9 @@ public ValueTask ExecuteAsync(IConsole console)
7982
.EnumerateFiles("*.symbols.json", SearchOption.AllDirectories)
8083
.Where(f => Path.GetFileName(f.FullName) != "pregenerated.symbols.json");
8184

82-
string pregeneratedPath = Path.Combine(PlatformSymbolInput.FullName, "pregenerated.symbols.json");
85+
string pregeneratedPath = PregeneratedSymbolsPath is null ?
86+
Path.Combine(PlatformSymbolInput.FullName, "pregenerated.symbols.json") :
87+
PregeneratedSymbolsPath;
8388
if (File.Exists(pregeneratedPath)) {
8489
symbolFiles = symbolFiles.Prepend(new FileInfo(pregeneratedPath));
8590
}

ModuleTweaker/Commands/MainCommand.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public class MainCommand : ICommand
2929
[CommandOption("platform", 'p', Description = "Target platform for symbol generation (e.g., win-client, win-server).", IsRequired = false)]
3030
public string Platform { get; set; } = "win-client";
3131

32+
[CommandOption("pregen-sym", Description = "Overrides the default pregenerated.symbols.json file folder.")]
33+
public string? PregeneratedSymbolsPath { get; set; }
34+
3235
public ValueTask ExecuteAsync(IConsole console)
3336
{
3437
FileInfo module = new(ModulePath);
@@ -96,7 +99,9 @@ ulong ParseAddress(string? address)
9699
.EnumerateFiles("*.symbols.json", SearchOption.AllDirectories)
97100
.Where(f => Path.GetFileName(f.FullName) != "pregenerated.symbols.json");
98101

99-
string pregeneratedPath = Path.Combine(PlatformSymbolInput.FullName, "pregenerated.symbols.json");
102+
string pregeneratedPath = PregeneratedSymbolsPath is null ?
103+
Path.Combine(PlatformSymbolInput.FullName, "pregenerated.symbols.json") :
104+
PregeneratedSymbolsPath;
100105
if (File.Exists(pregeneratedPath)) {
101106
symbolFiles = symbolFiles.Prepend(new FileInfo(pregeneratedPath));
102107
}

0 commit comments

Comments
 (0)