From fe1400476a9347a4cd056bc72d5aa04e1b1d670d Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Wed, 16 Jan 2019 11:20:20 -0600 Subject: [PATCH] DiscUtils: Workaround a bug by always assuming the long name is used --- src/LibHac.Nand/DiscUtils.Fat/FileName.cs | 6 +++++- src/LibHac.Nand/FatFileSystemProvider.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/LibHac.Nand/DiscUtils.Fat/FileName.cs b/src/LibHac.Nand/DiscUtils.Fat/FileName.cs index 1e37965c..4a46f844 100644 --- a/src/LibHac.Nand/DiscUtils.Fat/FileName.cs +++ b/src/LibHac.Nand/DiscUtils.Fat/FileName.cs @@ -63,6 +63,11 @@ namespace DiscUtils.Fat _raw = new byte[11]; byte[] bytes = encoding.GetBytes(name.ToUpperInvariant()); + if (useLongName) + { + LongName = name; + } + int nameIdx = 0; int rawIdx = 0; while (nameIdx < bytes.Length && bytes[nameIdx] != '.' && rawIdx < _raw.Length) @@ -80,7 +85,6 @@ namespace DiscUtils.Fat { if(!useLongName) throw new ArgumentException("File name too long '" + name + "'", nameof(name)); - LongName = name; } if (rawIdx == 0) { diff --git a/src/LibHac.Nand/FatFileSystemProvider.cs b/src/LibHac.Nand/FatFileSystemProvider.cs index ed6634a9..9a1e9f9f 100644 --- a/src/LibHac.Nand/FatFileSystemProvider.cs +++ b/src/LibHac.Nand/FatFileSystemProvider.cs @@ -104,7 +104,7 @@ namespace LibHac.Nand internal static string ToDiscUtilsPath(string path) { - return path.Replace("/", @"\\"); + return path.Replace("/", @"\"); } } }