Skip to content

Commit 0186695

Browse files
committed
ModFw update and improvements to file resolutions
1 parent eb5fd5d commit 0186695

15 files changed

Lines changed: 40 additions & 28 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,6 @@ OTAPI.Client.Launcher/OTAPI.app/
358358
server/
359359
dependencies/
360360
terraria-server-*
361+
artifact-*/
362+
AutoGenerated.target
363+
*.mfw.md

OTAPI.Client.Launcher/Actions/OTAPI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static class OTAPI
3535
static void CompileAndInstall() //considering to keep or not. this can recompile OTAPI mods on launch...which will be great for developing it. will look into when i get back to it one day
3636
{
3737
ModContext ctx = new("OTAPI");
38-
ctx.BaseDirectory = "patchtime";
38+
ctx.BaseDirectory = Path.Combine(ModContext.DefaultBaseDirectory, "patchtime");
3939
var cl = new CSharpLoader(ctx)
4040
.SetAutoLoadAssemblies(false)
4141
.SetClearExistingModifications(false)

OTAPI.Client.Launcher/OTAPI.Client.Launcher.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
</ItemGroup>
5454
<ItemGroup>
5555
<PackageReference Include="ImGui.NET" Version="1.91.6.1" GeneratePathProperty="true" />
56-
<PackageReference Include="ModFramework.Modules.ClearScript" Version="1.1.13" GeneratePathProperty="true" />
57-
<PackageReference Include="ModFramework.Modules.CSharp" Version="1.1.13" GeneratePathProperty="true" />
58-
<PackageReference Include="ModFramework.Modules.Lua" Version="1.1.13" GeneratePathProperty="true" />
56+
<PackageReference Include="ModFramework.Modules.ClearScript" Version="1.1.14" GeneratePathProperty="true" />
57+
<PackageReference Include="ModFramework.Modules.CSharp" Version="1.1.14" GeneratePathProperty="true" />
58+
<PackageReference Include="ModFramework.Modules.Lua" Version="1.1.14" GeneratePathProperty="true" />
5959
<PackageReference Include="SharpZipLib" Version="1.4.2" />
6060
<PackageReference Include="System.Drawing.Common" Version="9.0.2" />
6161
<PackageReference Include="MonoMod.RuntimeDetour.HookGen" Version="22.7.31.1" />

OTAPI.Patcher/NugetPackageBuilder.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,22 @@ public void Build(ModFwModder modder)
7878
var packageBuilder = new NuGet.Packaging.PackageBuilder();
7979
packageBuilder.Populate(manifest.Metadata);
8080

81-
packageBuilder.AddFiles("../../../../", "COPYING.txt", "COPYING.txt");
81+
var basePath = Path.Combine(AppContext.BaseDirectory, "../../../../");
82+
packageBuilder.AddFiles(basePath, "COPYING.txt", "COPYING.txt");
8283

8384
foreach (var platform in platforms)
8485
{
8586
var dest = Path.Combine("lib", platform);
86-
packageBuilder.AddFiles(Environment.CurrentDirectory, "OTAPI.dll", dest);
87-
packageBuilder.AddFiles(Environment.CurrentDirectory, "OTAPI.Runtime.dll", dest);
87+
packageBuilder.AddFiles(AppContext.BaseDirectory, "OTAPI.dll", dest);
88+
packageBuilder.AddFiles(AppContext.BaseDirectory, "OTAPI.Runtime.dll", dest);
8889
}
8990

90-
if (File.Exists(PackageName))
91-
File.Delete(PackageName);
91+
var output = Path.Combine(AppContext.BaseDirectory, PackageName);
9292

93-
using (var srm = File.OpenWrite(PackageName))
93+
if (File.Exists(output))
94+
File.Delete(output);
95+
96+
using (var srm = File.OpenWrite(output))
9497
packageBuilder.Save(srm);
9598
}
9699
}

OTAPI.Patcher/OTAPI.Patcher.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
<PackageReleaseNotes>Terraria 1.4.4.9 on .NET9</PackageReleaseNotes>
1111
</PropertyGroup>
1212
<ItemGroup>
13-
<PackageReference Include="ModFramework.Modules.ClearScript" Version="1.1.13" />
14-
<PackageReference Include="ModFramework.Modules.CSharp" Version="1.1.13" />
15-
<PackageReference Include="ModFramework.Modules.Lua" Version="1.1.13" />
13+
<PackageReference Include="ModFramework.Modules.ClearScript" Version="1.1.14" />
14+
<PackageReference Include="ModFramework.Modules.CSharp" Version="1.1.14" />
15+
<PackageReference Include="ModFramework.Modules.Lua" Version="1.1.14" />
1616
<PackageReference Include="Steamworks.NET" Version="2024.8.0" />
1717
<PackageReference Include="MonoMod.RuntimeDetour.HookGen" Version="22.7.31.1" />
1818
<PackageReference Include="MonoMod.RuntimeDetour" Version="25.2.3" />

OTAPI.Patcher/Targets/IPatchTarget.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ public static void WriteCIArtifacts(this IPatchTarget target, string outputFolde
8484
if (Directory.Exists(outputFolder)) Directory.Delete(outputFolder, true);
8585
Directory.CreateDirectory(outputFolder);
8686

87-
File.Copy("../../../../COPYING.txt", Path.Combine(outputFolder, "COPYING.txt"));
88-
File.Copy("OTAPI.dll", Path.Combine(outputFolder, "OTAPI.dll"));
89-
File.Copy("OTAPI.Runtime.dll", Path.Combine(outputFolder, "OTAPI.Runtime.dll"));
87+
File.Copy(Path.Combine(AppContext.BaseDirectory, "../../../../COPYING.txt"), Path.Combine(outputFolder, "COPYING.txt"));
88+
File.Copy(Path.Combine(AppContext.BaseDirectory, "OTAPI.dll"), Path.Combine(outputFolder, "OTAPI.dll"));
89+
File.Copy(Path.Combine(AppContext.BaseDirectory, "OTAPI.Runtime.dll"), Path.Combine(outputFolder, "OTAPI.Runtime.dll"));
9090
}
9191

9292
public static void AddEnvMetadata(this ModFwModder modder)

OTAPI.Patcher/Targets/MobileServerTarget.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License
1818
*/
1919
using ModFramework;
2020
using OTAPI.Patcher.Resolvers;
21+
using System;
22+
using System.IO;
2123

2224
namespace OTAPI.Patcher.Targets;
2325

@@ -28,7 +30,7 @@ public class MobileServerTarget : PCServerTarget
2830
public override string ArtifactName { get; } = "artifact-mobile";
2931
public override IFileResolver FileResolver { get; } = new MobileFileResolver();
3032

31-
public override NugetPackageBuilder NugetPackager { get; } = new("OTAPI.Mobile.nupkg", "../../../../docs/OTAPI.Mobile.nuspec");
33+
public override NugetPackageBuilder NugetPackager { get; } = new("OTAPI.Mobile.nupkg", Path.Combine(AppContext.BaseDirectory, "../../../../docs/OTAPI.Mobile.nuspec"));
3234
public override MarkdownDocumentor MarkdownDocumentor { get; } = new("OTAPI.Mobile.Server.mfw.md");
3335
}
3436

OTAPI.Patcher/Targets/PCClientTarget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public Task PatchAsync()
163163
{
164164
Console.WriteLine($"Open Terraria API v{Common.GetVersion()}");
165165

166-
ModContext.BaseDirectory = "patchtime"; // PatchtimePath;
166+
ModContext.BaseDirectory = Path.Combine(ModContext.DefaultBaseDirectory, "patchtime");
167167
var refs = Path.Combine(Environment.CurrentDirectory, "OTAPI.dll");
168168
var otapi = Path.Combine(InstallDestination, "OTAPI.exe");
169169
var hooks = Path.Combine(InstallDestination, "OTAPI.Runtime.dll");

OTAPI.Patcher/Targets/PCServerTarget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class PCServerTarget : IServerPatchTarget
2626

2727
public virtual IFileResolver FileResolver { get; } = new PCFileResolver();
2828

29-
public virtual NugetPackageBuilder NugetPackager { get; } = new("OTAPI.PC.nupkg", "../../../../docs/OTAPI.PC.nuspec");
29+
public virtual NugetPackageBuilder NugetPackager { get; } = new("OTAPI.PC.nupkg", Path.Combine(AppContext.BaseDirectory, "../../../../docs/OTAPI.PC.nuspec"));
3030
public virtual MarkdownDocumentor MarkdownDocumentor { get; } = new("OTAPI.PC.Server.mfw.md");
3131

3232
public virtual string ArtifactName { get; } = "artifact-pc";

OTAPI.Patcher/Targets/TMLPCServerTarget.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License
1919

2020
using ModFramework;
2121
using OTAPI.Patcher.Resolvers;
22+
using System;
2223
using System.IO;
2324
using System.Linq;
2425

@@ -31,7 +32,7 @@ public class TMLPCServerTarget : PCServerTarget
3132
public override string ArtifactName { get; } = "artifact-tml";
3233
public override IFileResolver FileResolver { get; } = new TMLFileResolver();
3334

34-
public override NugetPackageBuilder NugetPackager { get; } = new("OTAPI.TML.nupkg", "../../../../docs/OTAPI.TML.nuspec");
35+
public override NugetPackageBuilder NugetPackager { get; } = new("OTAPI.TML.nupkg", Path.Combine(AppContext.BaseDirectory, "../../../../docs/OTAPI.TML.nuspec"));
3536
public override MarkdownDocumentor MarkdownDocumentor { get; } = new("OTAPI.TML.PC.Server.mfw.md");
3637

3738
public override bool PublicEverything => false; // tml expects various classes to still be private

0 commit comments

Comments
 (0)