Make script paths always use / as the path seperator to be cross-compatible

This commit is contained in:
LukeFZ
2024-07-15 16:11:24 +02:00
parent 85154ded5b
commit b4aaa8df5e

View File

@@ -72,9 +72,11 @@ namespace Il2CppInspector.Outputs
private void writeJsonMetadata(string jsonMetadataFile) => new JSONMetadata(model).Write(jsonMetadataFile); private void writeJsonMetadata(string jsonMetadataFile) => new JSONMetadata(model).Write(jsonMetadataFile);
private string getRelativePath(string from, string to) => private string getRelativePath(string from, string to) =>
Path.GetRelativePath(Path.GetDirectoryName(Path.GetFullPath(from)), Path.GetRelativePath(Path.GetDirectoryName(Path.GetFullPath(from))!,
Path.GetDirectoryName(Path.GetFullPath(to))) Path.GetDirectoryName(Path.GetFullPath(to))!)
+ Path.DirectorySeparatorChar + '/'
// 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); + Path.GetFileName(to);
} }
} }