Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path separator fix (issue #5) #6

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions TACTSharp/InstallInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public unsafe InstallInstance(string path)
this.Entries = [];
for (var i = 0; i < this.NumEntries; i++)
{
var name = installData[offs..].ReadNullTermString();
var name = installData[offs..].ReadNullTermString().Replace('/', '\\');
offs += name.Length + 1;

var contentHash = installData.Slice(offs, this.HashSize).ToArray();
Expand Down Expand Up @@ -90,7 +90,7 @@ public struct InstallTagEntry

public struct InstallFileEntry
{
public string name;
public string name; // Normalized to \, but not enforced upper/lowercase.
public byte[] md5;
public uint size;
public string[] tags;
Expand Down
5 changes: 4 additions & 1 deletion TACTTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ static async Task Main(string[] args)
{
var (eKey, decodedSize, fileName) = target;

fileName = fileName.Replace('\\', Path.DirectorySeparatorChar);
fileName = fileName.Replace('/', Path.DirectorySeparatorChar);

Console.WriteLine("Extracting " + Convert.ToHexStringLower(eKey) + " to " + fileName);

try
Expand Down Expand Up @@ -376,7 +379,7 @@ private static void HandleFDID(BuildInstance build, string fdid, string? filenam

private static void HandleFileName(BuildInstance build, string filename, string? outputFilename)
{
var fileEntries = build.Install.Entries.Where(x => x.name.Equals(filename, StringComparison.InvariantCultureIgnoreCase)).ToList();
var fileEntries = build.Install.Entries.Where(x => x.name.Equals(filename.Replace('/', '\\'), StringComparison.InvariantCultureIgnoreCase)).ToList();
if (fileEntries.Count == 0)
{
using (var hasher = new Jenkins96())
Expand Down
Loading