Skip to content

Commit

Permalink
Merge branch 'Issue#241' into v1.5-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
RevZero committed Sep 10, 2021
2 parents 49d7ffd + 533003d commit 94e5960
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions xcom2-launcher/xcom2-launcher/Classes/Mod/ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using HeyRed.MarkdownSharp;
using Newtonsoft.Json;
using Steamworks;
using XCOM2Launcher.Helper;
Expand Down Expand Up @@ -468,19 +466,14 @@ public string GetReadMe()
/// <summary>
/// Returns a relative path to this mod's folder.
/// </summary>
/// <param name="relativeTo"></param>
/// <param name="target"></param>
/// <returns></returns>
public string GetPathRelative(string relativeTo)
public string GetPathRelative(string target)
{
Uri modPath = new Uri(relativeTo);
Uri filePath = new Uri(Path);
var relativePath = filePath.MakeRelativeUri(modPath).ToString();

// Trim off the mod ID number, it's not useful here
int i = relativePath.IndexOf("Config", StringComparison.Ordinal);
relativePath = relativePath.Substring(i);

return Uri.UnescapeDataString(relativePath);
var targetUri = new Uri(target);
var modUri = new Uri(Path.TrimEnd(FilePath.DirectorySeparatorChar, FilePath.AltDirectorySeparatorChar) + FilePath.DirectorySeparatorChar);
var relativeUri = modUri.MakeRelativeUri(targetUri).ToString();
return Uri.UnescapeDataString(relativeUri);
}

/// <summary>
Expand Down

0 comments on commit 94e5960

Please sign in to comment.