Attempt to make more robust.

This commit is contained in:
Eusth 2017-02-17 18:33:07 +01:00
parent 21ab05b59c
commit a0e2310b8a
2 changed files with 14 additions and 2 deletions

View file

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
namespace IPA
@ -28,6 +29,7 @@ namespace IPA
public string ProjectRoot { get; private set; }
public string IPARoot { get; private set; }
public string ShortcutPath { get; private set; }
public string IPA { get; private set; }
private PatchContext() { }
@ -39,6 +41,7 @@ namespace IPA
context.Executable = args[0];
context.ProjectRoot = Path.GetDirectoryName(context.Executable);
context.IPARoot = Path.Combine(context.ProjectRoot, "IPA");
context.IPA = Assembly.GetExecutingAssembly().Location ?? Path.Combine(context.ProjectRoot, "IPA.exe");
context.LauncherPathSrc = Path.Combine(context.IPARoot, "Launcher.exe");
context.DataPathSrc = Path.Combine(context.IPARoot, "Data");
context.PluginsFolder = Path.Combine(context.ProjectRoot, "Plugins");

View file

@ -92,8 +92,17 @@ namespace IPA
// Creating shortcut
if(!File.Exists(context.ShortcutPath))
{
Console.Write("Creating shortcut... ");
Shortcut.Create(context.ShortcutPath, Assembly.GetExecutingAssembly().Location, Args(context.Executable, "--launch"), context.ProjectRoot, "Launches the game and makes sure it's in a patched state", "", context.Executable);
Console.Write("Creating shortcut to IPA ({0})... ", context.IPA);
Shortcut.Create(
fileName: context.ShortcutPath,
targetPath: context.IPA,
arguments: Args(context.Executable, "--launch"),
workingDirectory: context.ProjectRoot,
description: "Launches the game and makes sure it's in a patched state",
hotkey: "",
iconPath: context.Executable
);
Console.WriteLine("Created");
}
}