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

View file

@ -92,8 +92,17 @@ namespace IPA
// Creating shortcut // Creating shortcut
if(!File.Exists(context.ShortcutPath)) if(!File.Exists(context.ShortcutPath))
{ {
Console.Write("Creating shortcut... "); Console.Write("Creating shortcut to IPA ({0})... ", context.IPA);
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); 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"); Console.WriteLine("Created");
} }
} }