mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Split functionality from AddDirectoryEntries into ScanDirectoryTree (generic directory scanning; OS depedent) and ComputeNameSize (specific for CVolumeDirectory; OS independent).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@646 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
1a27044b0a
commit
5a3aee5118
@ -455,7 +455,7 @@ static bool ReadFoundFile(const WIN32_FIND_DATA& ffd, CVolumeDirectory::FSTEntry
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 CVolumeDirectory::AddDirectoryEntries(const std::string& _Directory, FSTEntry& parentEntry)
|
||||
static u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry)
|
||||
{
|
||||
// Find the first file in the directory.
|
||||
WIN32_FIND_DATA ffd;
|
||||
@ -483,7 +483,6 @@ u32 CVolumeDirectory::AddDirectoryEntries(const std::string& _Directory, FSTEntr
|
||||
++foundEntries;
|
||||
|
||||
parentEntry.children.push_back(entry);
|
||||
m_totalNameSize += entry.virtualName.length() + 1;
|
||||
}
|
||||
} while (FindNextFile(hFind, &ffd) != 0);
|
||||
}
|
||||
@ -493,11 +492,35 @@ u32 CVolumeDirectory::AddDirectoryEntries(const std::string& _Directory, FSTEntr
|
||||
return foundEntries;
|
||||
}
|
||||
#else
|
||||
u32 CVolumeDirectory::AddDirectoryEntries(const std::string& _Directory, FSTEntry& parentEntry)
|
||||
static u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry)
|
||||
{
|
||||
// TODO - Insert linux stuff here
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static u32 ComputeNameSize(const FSTEntry& parentEntry)
|
||||
{
|
||||
u32 nameSize = 0;
|
||||
const std::vector<FSTEntry>& children = parentEntry.children;
|
||||
for (std::vector<FSTEntry>::const_iterator it = children.begin();
|
||||
it != children.end(); ++it)
|
||||
{
|
||||
const FSTEntry& entry = *it;
|
||||
if (entry.isDirectory)
|
||||
{
|
||||
nameSize += ComputeNameSize(entry);
|
||||
}
|
||||
nameSize += entry.virtualName.length() + 1;
|
||||
}
|
||||
return nameSize;
|
||||
}
|
||||
|
||||
u32 CVolumeDirectory::AddDirectoryEntries(const std::string& _Directory, FSTEntry& parentEntry)
|
||||
{
|
||||
u32 foundEntries = ScanDirectoryTree(_Directory, parentEntry);
|
||||
m_totalNameSize += ComputeNameSize(parentEntry);
|
||||
return foundEntries;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -30,6 +30,15 @@
|
||||
namespace DiscIO
|
||||
{
|
||||
|
||||
struct FSTEntry
|
||||
{
|
||||
bool isDirectory;
|
||||
u32 size; // file length or number of entries from children
|
||||
std::string physicalName; // name on disk
|
||||
std::string virtualName; // name in FST names table
|
||||
std::vector<FSTEntry> children;
|
||||
};
|
||||
|
||||
class CVolumeDirectory
|
||||
: public IVolume
|
||||
{
|
||||
@ -55,15 +64,6 @@ class CVolumeDirectory
|
||||
|
||||
void BuildFST();
|
||||
|
||||
struct FSTEntry
|
||||
{
|
||||
bool isDirectory;
|
||||
u32 size; // file length or number of entries from children
|
||||
std::string physicalName; // name on disk
|
||||
std::string virtualName; // name in FST names table
|
||||
std::vector<FSTEntry> children;
|
||||
};
|
||||
|
||||
private:
|
||||
static std::string ExtractDirectoryName(const std::string& _rDirectory);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user