Skip to content

Commit

Permalink
update to use manifest.json metadata tag
Browse files Browse the repository at this point in the history
  • Loading branch information
neomoth committed Oct 31, 2024
1 parent 0b4d732 commit b37eb4d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions NeoQOLPack/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ private async Task GetVersion()
if (currentDir is null)
throw new NullReferenceException(
"if this gets thrown i have no fucking idea how you managed to do that.");
string jsonPath = Path.Combine(currentDir, "mod.json");
string jsonPath = Path.Combine(currentDir, "manifest.json");
if (!File.Exists(jsonPath))
throw new FileNotFoundException("mod.json was not found in the mod's directory.");
throw new FileNotFoundException("manifest.json was not found in the mod's directory.");
string jsonContent = File.ReadAllText(jsonPath);
JsonDocument document = JsonDocument.Parse(jsonContent);
if (document.RootElement.TryGetProperty("version", out JsonElement version))
if (document.RootElement.GetProperty("Metadata").TryGetProperty("Version", out JsonElement version))
{
string? versionAsString = version.GetString();
if (versionAsString is not null) versionTag = $"v{versionAsString}";
}
else throw new Exception("'version' property not found in mod.json.");
else throw new Exception("'version' property not found in manifest.json.");
}
catch (Exception e)
{
Expand Down
1 change: 0 additions & 1 deletion NeoQOLPack/NeoQOLPack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

<ItemGroup>
<None Include="manifest.json" CopyToOutputDirectory="PreserveNewest"/>
<None Include="mod.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 8 additions & 1 deletion NeoQOLPack/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
"Dependencies":
[
"Sulayre.Lure"
]
],
"Metadata":
{
"Name": "NeoOQLPack",
"Description": "Collection of Quality of Life patches such as inventory stacking, a sell all button, etcetera.",
"Version": "1.0.6",
"Author": "neomoth"
}
}
6 changes: 0 additions & 6 deletions NeoQOLPack/mod.json

This file was deleted.

0 comments on commit b37eb4d

Please sign in to comment.