Skip to content

Commit d7ea6fd

Browse files
committed
Clean temp files generated during mod staging
1 parent 725a476 commit d7ea6fd

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

Mods/Alpakit/Source/Alpakit.Automation/PackagePlugin.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,20 @@ public override void ExecuteBuild()
7171
{
7272
var DeployContextList = Project.CreateDeploymentContext(projectParams, false, true);
7373
foreach (var SC in DeployContextList)
74+
{
7475
Project.CleanStagingDirectory(projectParams, SC);
76+
DeleteDirectory(GetTempDirForStaging(projectParams, SC));
77+
}
7578
}
7679

7780
if (projectParams.DedicatedServer)
7881
{
7982
var DeployContextList = Project.CreateDeploymentContext(projectParams, true, true);
8083
foreach (var SC in DeployContextList)
84+
{
8185
Project.CleanStagingDirectory(projectParams, SC);
86+
DeleteDirectory(GetTempDirForStaging(projectParams, SC));
87+
}
8288
}
8389
}
8490
}
@@ -274,8 +280,7 @@ private void ModifyModules(ProjectParams ProjectParams, DeploymentContext SC)
274280
// The game specifically allows SML as BuildId to be loaded by any game build
275281
moduleManifestFile.BuildId = "SML";
276282

277-
var intermediateModuleFilePath = FileReference.Combine(ProjectParams.DLCFile.Directory, "Intermediate",
278-
"Staging", SC.FinalCookPlatform, manifest.Path.MakeRelativeTo(ProjectParams.DLCFile.Directory));
283+
var intermediateModuleFilePath = FileReference.Combine(GetTempDirForStaging(ProjectParams, SC), manifest.Path.MakeRelativeTo(ProjectParams.DLCFile.Directory));
279284
var outputFilePath = SC.GetStagedFileLocation(manifest.Path);
280285
moduleManifestFile.Write(intermediateModuleFilePath);
281286
SC.StageFile(StagedFileType.NonUFS, intermediateModuleFilePath, outputFilePath);
@@ -290,10 +295,15 @@ private void MarkGameFeature(ProjectParams ProjectParams, DeploymentContext SC)
290295

291296
JsonObject PluginDescriptor = JsonObject.Read(ProjectParams.DLCFile);
292297
PluginDescriptor.AddOrSetFieldValue("GameFeature", true);
293-
FileReference TempPluginFile = FileReference.Combine(ProjectParams.DLCFile.Directory, "Intermediate", "Staging", SC.FinalCookPlatform, ProjectParams.DLCFile.GetFileName());
298+
FileReference TempPluginFile = FileReference.Combine(GetTempDirForStaging(ProjectParams, SC), ProjectParams.DLCFile.GetFileName());
294299
CreateDirectory(TempPluginFile.Directory);
295300
string jsonString = PluginDescriptor.ToJsonString();
296301
FileReference.WriteAllText(TempPluginFile, jsonString);
297302
SC.StageFile(StagedFileType.NonUFS, TempPluginFile, SC.GetStagedFileLocation(ProjectParams.DLCFile));
298303
}
304+
305+
private DirectoryReference GetTempDirForStaging(ProjectParams ProjectParams, DeploymentContext SC)
306+
{
307+
return DirectoryReference.Combine(ProjectParams.DLCFile.Directory, "Intermediate", "Staging", SC.FinalCookPlatform);
308+
}
299309
}

0 commit comments

Comments
 (0)