mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-25 20:34:13 +08:00
(IndexReader): use Path.Combine to concatenate file names.
This commit is contained in:
parent
9084a4857f
commit
cc229c51cc
@ -298,7 +298,7 @@ namespace GameRes.Formats.DxLib
|
|||||||
if (dir.DirOffset != -1 && dir.ParentDirOffset != -1)
|
if (dir.DirOffset != -1 && dir.ParentDirOffset != -1)
|
||||||
{
|
{
|
||||||
m_input.BaseStream.Position = m_header.FileTable + dir.DirOffset;
|
m_input.BaseStream.Position = m_header.FileTable + dir.DirOffset;
|
||||||
root = root + ExtractFileName (m_input.ReadUInt32()) + '\\';
|
root = Path.Combine (root, ExtractFileName (m_input.ReadUInt32()));
|
||||||
}
|
}
|
||||||
long current_pos = m_header.FileTable + dir.FileTable;
|
long current_pos = m_header.FileTable + dir.FileTable;
|
||||||
for (int i = 0; i < dir.FileCount; ++i)
|
for (int i = 0; i < dir.FileCount; ++i)
|
||||||
@ -310,6 +310,8 @@ namespace GameRes.Formats.DxLib
|
|||||||
uint offset = m_input.ReadUInt32();
|
uint offset = m_input.ReadUInt32();
|
||||||
if (0 != (attr & 0x10)) // FILE_ATTRIBUTE_DIRECTORY
|
if (0 != (attr & 0x10)) // FILE_ATTRIBUTE_DIRECTORY
|
||||||
{
|
{
|
||||||
|
if (0 == offset || table_offset == offset)
|
||||||
|
throw new InvalidFormatException ("Infinite recursion in DXA directory index");
|
||||||
ReadFileTable (root, offset);
|
ReadFileTable (root, offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -318,7 +320,7 @@ namespace GameRes.Formats.DxLib
|
|||||||
int packed_size = -1;
|
int packed_size = -1;
|
||||||
if (m_version >= 2)
|
if (m_version >= 2)
|
||||||
packed_size = m_input.ReadInt32();
|
packed_size = m_input.ReadInt32();
|
||||||
var entry = FormatCatalog.Instance.Create<PackedEntry> (root+ExtractFileName (name_offset));
|
var entry = FormatCatalog.Instance.Create<PackedEntry> (Path.Combine (root, ExtractFileName (name_offset)));
|
||||||
entry.Offset = m_header.BaseOffset + offset;
|
entry.Offset = m_header.BaseOffset + offset;
|
||||||
entry.UnpackedSize = size;
|
entry.UnpackedSize = size;
|
||||||
entry.IsPacked = -1 != packed_size;
|
entry.IsPacked = -1 != packed_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user