Skip to content

Commit

Permalink
Fix breaking partial mods (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoes1286 authored Feb 21, 2024
1 parent 763dba3 commit 447e135
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Deliter/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,11 @@ private void Convert(string path, string name)
{
string directory = Path.GetDirectoryName(path)!;
string backupPath = path + ".bak";
string backupPartialPath = path + ".partial.bak";
string project = Path.Combine(directory, "project.yaml");
string backupProject = project + ".bak";


string resources = Path.Combine(directory, "resources");

// Detect previous failed conversion attempts
Expand Down Expand Up @@ -431,8 +433,15 @@ private void Convert(string path, string name)
// Ignore if backup already exists because this might be a partially delited mod.

if (!File.Exists(backupPath)) {
File.Copy(path, backupPath, true);
File.Delete(path);
// If the mod still has some existing dependencies in deli, don't delete the deli.
// Rename mod to .deli.bak.partial so that it doesn't run previous fixes for bugs.
if (partial) {
File.Copy(path, backupPartialPath, true);
}
else {
File.Copy(path, backupPath, true);
File.Delete(path);
}
}

LogInfo($"Converted '{name}' to a Mason project");
Expand Down

0 comments on commit 447e135

Please sign in to comment.