Skip to content

Commit

Permalink
Merge pull request #15 from CreativeMD/master
Browse files Browse the repository at this point in the history
Updated to modtools v1.5.2
  • Loading branch information
CreativeMD authored May 9, 2019
2 parents 23b741e + b66d0d0 commit 20c2d69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vsmodtools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Program
internal static List<Command> commands = new List<Command>();
internal static Command currentCommand;

public const string version = "1.5.1";
public const string version = "1.5.2";

static void Init()
{
Expand Down
10 changes: 9 additions & 1 deletion vsmodtools/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public override bool Run(string[] args)
Console.WriteLine("Setting up workspace ...");
List<string> possiblePaths = new List<string>();

bool linux = false;
if (args.Length == 1)
{
possiblePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vintagestory"));
Expand All @@ -196,6 +197,7 @@ public override bool Run(string[] args)
possiblePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "ApplicationData", "Vintagestory"));
possiblePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "ApplicationData", "vintagestory"));
possiblePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "Vintagestory"));
linux = true;
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Expand Down Expand Up @@ -261,10 +263,16 @@ public override bool Run(string[] args)

//also the mod template should be a .net v4.5.2 class library and not a .netcore standard 2 (but this might open up even more issues)

string[] postBuildCommand = new string[] { copyCommand + " \"$(TargetPath)\" \"" + vspath.Replace("$(AppData)", "%25appdata%25") + "Mods\\\"", copyCommand + " \"$(TargetDir)\\$(TargetName).pdb\" \"" + vspath.Replace("$(AppData)", "%25appdata%25") + "Mods\\\"" };

if (linux)
for (int i = 0; i < postBuildCommand.Length; i++)
postBuildCommand[i] = postBuildCommand[i].Replace("\\", "/");

new Patcher(new ConditionedLinePatch("<Reference Include=\"protobuf-net\">", "<HintPath>", "<HintPath>" + vspath + "Lib\\protobuf-net.dll</HintPath>", "</Reference>"),
new ConditionedLinePatch("<Reference Include=\"VintagestoryAPI", "<HintPath>", "<HintPath>" + vspath + "VintagestoryAPI.dll</HintPath>", "</Reference>"),
new ConditionedLinePatch("<Reference Include=\"VSSurvivalMod\">", "<HintPath>", "<HintPath>" + vspath + "Mods\\VSSurvivalMod.dll</HintPath>", "</Reference>"),
new InBetweenPatch("<PostBuildEvent>", "</PostBuildEvent>", copyCommand + " \"$(TargetPath)\" \"" + vspath.Replace("$(AppData)", "%25appdata%25") + "Mods\\\"", copyCommand + " \"$(TargetDir)\\$(TargetName).pdb\" \"" + vspath.Replace("$(AppData)", "%25appdata%25") + "Mods\\\"")
new InBetweenPatch("<PostBuildEvent>", "</PostBuildEvent>", postBuildCommand)
).Patch(Tools.GetApplicationDirectory() + "VSModLauncher.csproj");

Patcher modProjectFilePatcher = new Patcher(new ConditionedLinePatch("<Reference Include=\"VintagestoryAPI\">", "<HintPath>", "<HintPath>" + vspath + "VintagestoryAPI.dll</HintPath>", "</Reference>"));
Expand Down

0 comments on commit 20c2d69

Please sign in to comment.