mirror of https://github.com/AxioDL/nod.git
Fix FST parent directory index
This commit is contained in:
parent
e99290e3c3
commit
d597400f4a
|
@ -446,7 +446,8 @@ public:
|
||||||
bool recursiveBuildNodes(IPartWriteStream& ws, bool system, const SystemChar* dirIn);
|
bool recursiveBuildNodes(IPartWriteStream& ws, bool system, const SystemChar* dirIn);
|
||||||
|
|
||||||
bool recursiveBuildFST(const SystemChar* dirIn,
|
bool recursiveBuildFST(const SystemChar* dirIn,
|
||||||
std::function<void(void)> incParents);
|
std::function<void(void)> incParents,
|
||||||
|
size_t parentDirIdx);
|
||||||
|
|
||||||
void recursiveMergeNodesPre(const DiscBase::IPartition::Node* nodeIn, const SystemChar* dirIn);
|
void recursiveMergeNodesPre(const DiscBase::IPartition::Node* nodeIn, const SystemChar* dirIn);
|
||||||
bool recursiveMergeNodes(IPartWriteStream& ws, bool system,
|
bool recursiveMergeNodes(IPartWriteStream& ws, bool system,
|
||||||
|
|
|
@ -410,7 +410,8 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveBuildNodes(IPartWriteStream
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiscBuilderBase::PartitionBuilderBase::recursiveBuildFST(const SystemChar* filesIn,
|
bool DiscBuilderBase::PartitionBuilderBase::recursiveBuildFST(const SystemChar* filesIn,
|
||||||
std::function<void(void)> incParents)
|
std::function<void(void)> incParents,
|
||||||
|
size_t parentDirIdx)
|
||||||
{
|
{
|
||||||
DirectoryEnumerator dEnum(filesIn, DirectoryEnumerator::Mode::DirsThenFilesSorted, false, false, true);
|
DirectoryEnumerator dEnum(filesIn, DirectoryEnumerator::Mode::DirsThenFilesSorted, false, false, true);
|
||||||
for (const DirectoryEnumerator::Entry& e : dEnum)
|
for (const DirectoryEnumerator::Entry& e : dEnum)
|
||||||
|
@ -418,10 +419,12 @@ bool DiscBuilderBase::PartitionBuilderBase::recursiveBuildFST(const SystemChar*
|
||||||
if (e.m_isDir)
|
if (e.m_isDir)
|
||||||
{
|
{
|
||||||
size_t dirNodeIdx = m_buildNodes.size();
|
size_t dirNodeIdx = m_buildNodes.size();
|
||||||
m_buildNodes.emplace_back(true, m_buildNameOff, 0, dirNodeIdx+1);
|
m_buildNodes.emplace_back(true, m_buildNameOff, parentDirIdx, dirNodeIdx+1);
|
||||||
addBuildName(e.m_name);
|
addBuildName(e.m_name);
|
||||||
incParents();
|
incParents();
|
||||||
if (!recursiveBuildFST(e.m_path.c_str(), [&](){m_buildNodes[dirNodeIdx].incrementLength(); incParents();}))
|
if (!recursiveBuildFST(e.m_path.c_str(),
|
||||||
|
[&](){m_buildNodes[dirNodeIdx].incrementLength(); incParents();},
|
||||||
|
dirNodeIdx))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -873,7 +876,7 @@ bool DiscBuilderBase::PartitionBuilderBase::buildFromDirectory(IPartWriteStream&
|
||||||
return false;
|
return false;
|
||||||
if (!recursiveBuildNodes(ws, false, filesIn.c_str()))
|
if (!recursiveBuildNodes(ws, false, filesIn.c_str()))
|
||||||
return false;
|
return false;
|
||||||
if (!recursiveBuildFST(filesIn.c_str(), [&](){m_buildNodes[0].incrementLength();}))
|
if (!recursiveBuildFST(filesIn.c_str(), [&](){m_buildNodes[0].incrementLength();}, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue