From b4aaa8df5ebd2e0c7a9f35bb62c5e0df0c001094 Mon Sep 17 00:00:00 2001 From: LukeFZ <17146677+LukeFZ@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:11:24 +0200 Subject: [PATCH] Make script paths always use / as the path seperator to be cross-compatible --- Il2CppInspector.Common/Outputs/PythonScript.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Il2CppInspector.Common/Outputs/PythonScript.cs b/Il2CppInspector.Common/Outputs/PythonScript.cs index 1f712e99..9be54838 100644 --- a/Il2CppInspector.Common/Outputs/PythonScript.cs +++ b/Il2CppInspector.Common/Outputs/PythonScript.cs @@ -72,9 +72,11 @@ public void WriteScriptToFile(string outputFile, string target, string existingT private void writeJsonMetadata(string jsonMetadataFile) => new JSONMetadata(model).Write(jsonMetadataFile); private string getRelativePath(string from, string to) => - Path.GetRelativePath(Path.GetDirectoryName(Path.GetFullPath(from)), - Path.GetDirectoryName(Path.GetFullPath(to))) - + Path.DirectorySeparatorChar + Path.GetRelativePath(Path.GetDirectoryName(Path.GetFullPath(from))!, + Path.GetDirectoryName(Path.GetFullPath(to))!) + + '/' + // We do not use Path.DirectorySeparatorChar here as scripts might be generated on windows then ran on linux, + // and / is cross-compatible + Path.GetFileName(to); } }