Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

Commit

Permalink
fixed uninstaller not uninstalling dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoes1286 committed Jan 21, 2021
1 parent 1fc2a0e commit 3a7d029
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
27 changes: 19 additions & 8 deletions src/Backend/Filesys/Uninstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public class Uninstaller
/// <param name="modid">ModID to delte</param>
public static void DeleteMod(string modid)
{
var instmods = InstalledMods.GetInstalledMods();
Console.WriteLine("0");
var instmods = InstalledMods.GetInstalledMods();
for (var i = 0; i < instmods.Length; i++)
if (instmods[i].ModId == modid)
{
Expand All @@ -29,7 +30,8 @@ public static void DeleteMod(string modid)

private static void parseDelArgs(ModFile mf)
{
if (mf.DelInfo == null)
Console.WriteLine("1");
if (mf.DelInfo == null)
{
mf = ModParsing.GetSpecificMod(mf.ModId);
if (mf.DelInfo == null || mf.DelInfo == "")
Expand All @@ -42,11 +44,20 @@ private static void parseDelArgs(ModFile mf)

var args = mf.DelInfo.Split('?');

for (var i = 0; i < args.Length; i++)
if (File.Exists(ModInstallerCommon.Files.MainFiledir + @"\" + args[i]))
File.Delete(ModInstallerCommon.Files.MainFiledir + @"\" + args[i]);
else if (Directory.Exists(ModInstallerCommon.Files.MainFiledir + @"\" + args[i]))
Directory.Delete(ModInstallerCommon.Files.MainFiledir + @"\" + args[i]);
}
for (var i = 0; i < args.Length; i++)
{
Console.WriteLine("Finding " + ModInstallerCommon.Files.MainFiledir + @"\" + args[i]);
if (File.Exists(ModInstallerCommon.Files.MainFiledir + @"\" + args[i]))
{
Console.WriteLine("Removing " + ModInstallerCommon.Files.MainFiledir + @"\" + args[i] + " as file");
File.Delete(ModInstallerCommon.Files.MainFiledir + @"\" + args[i]);
}
else if (Directory.Exists(ModInstallerCommon.Files.MainFiledir + @"\" + args[i]))
{
Console.WriteLine("Removing " + ModInstallerCommon.Files.MainFiledir + @"\" + args[i] + " as dir");
Directory.Delete(ModInstallerCommon.Files.MainFiledir + "/" + args[i], true);
}
}
}
}
}
6 changes: 3 additions & 3 deletions src/Backend/JSON/ExperimentalDatabase/mapmods.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"Description": "THIS MAP IS ABANDONED. I'm sorry, but this map runs like shit and I cannot find an easy way to fix it. I'll probably end up recreating the map in a less performance intensive way.\nA World War II themed TNH map, best experienced with music OFF and played with Grumbly GI Grayson.\nAlso includes a generic version for exploration and sandbox stuff.\nMay or may not also contain a lemon.\nLow Poly assets made by Synty.",
"Path": "https://bonetome.com/download.php?file=MDg4OTYxMmY2M2FiMDY1MSszNjUrNTY0",
"Website": "https://bonetome.com/h3vr/map/87/",
"Arguments": "unzipToDir?moveToFolder?Wurst War II Generic?CustomLevels/Generic/?Wurst War II Generic?moveToFolder?Wurst War II TNH?CustomLevels/TakeAndHold/?Wurst War II TNH",
"Arguments": "unzipToDir??moveToFolder?Wurst War II Generic?CustomLevels/Generic/?Wurst War II Generic?moveToFolder?Wurst War II TNH?CustomLevels/TakeAndHold/?Wurst War II TNH",
"Delinfo": "CustomLevels/Generic/Wurst War II Generic?CustomLevels/TakeAndHold/Wurst War II TNH",
"Dependencies": [
"wurstmod"
Expand All @@ -66,7 +66,7 @@
"Description": "A little town overrun with Outlaws.\n- pretty challenging, makes \"Cowboys\" into \"Cattlemen\"\n- you can move freely in Holds\n- has no barriers but natural cover\n- 8 Holds, 6 Supplypoints",
"Path": "https://bonetome.com/download.php?file=N2VjNTE4NGVjMGE0MzdiYis0NDErMTAyMw==",
"Website": "https://bonetome.com/h3vr/map/202/",
"Arguments": "unzipToDir?moveToFolder?TNH-Sanctuary 1.3?CustomLevels/Generic/?TNH-Sanctuary light?moveToFolder?TNH-Sanctuary light?CustomLevels/TakeAndHold/?TNH-Sanctuary light",
"Arguments": "unzipToDir??moveToFolder?TNH-Sanctuary 1.3?CustomLevels/Generic/?TNH-Sanctuary light?moveToFolder?TNH-Sanctuary light?CustomLevels/TakeAndHold/?TNH-Sanctuary light",
"Delinfo": "CustomLevels/Generic/TNH-Sanctuary 1.3?CustomLevels/TakeAndHold/TNH-Sanctuary light",
"Dependencies": [
"wurstmod"
Expand All @@ -83,7 +83,7 @@
"Description": "For my first Unity project, Ive built Fort Bratwurst, inspired by the drawing from u/GaPSMAV, with a few fun additions by me.",
"Path": "https://bonetome.com/download.php?file=N2VjNTE4NGVjMGE0MzdiYis0NDErMTAyMw==",
"Website": "https://bonetome.com/h3vr/map/201/",
"Arguments": "unzipToDir?moveToFolder?Generic-FortBratwurst?CustomLevels/Generic/?Generic-FortBratwurst",
"Arguments": "unzipToDir??moveToFolder?Generic-FortBratwurst?CustomLevels/Generic/?Generic-FortBratwurst",
"Delinfo": "CustomLevels/Generic/Generic-FortBratwurst",
"Dependencies": [
"wurstmod"
Expand Down

0 comments on commit 3a7d029

Please sign in to comment.