VFS: Fix various things
- The "ALL" fake pathID is replaced by what does SM, having a public var NULL_STRING which will acts as NULL when needed. To make compiler accepting public array, this patch was needed: https://hg.alliedmods.net/sourcemod-central/rev/b12f329def09 - The offset thing in read_dir: considering that's something very specific to this native and that implementation in CDirectory doesn't make sense because of the offset compatibility for windows, all code is now in the native.
This commit is contained in:
@@ -61,28 +61,16 @@ CDirectory::~CDirectory()
|
||||
}
|
||||
}
|
||||
|
||||
void CDirectory::NextEntry(cell* offset)
|
||||
DirHandle CDirectory::GetHandle()
|
||||
{
|
||||
return m_dir;
|
||||
}
|
||||
|
||||
void CDirectory::NextEntry()
|
||||
{
|
||||
#if defined PLATFORM_WINDOWS
|
||||
|
||||
if (offset)
|
||||
{
|
||||
// Should be declared after loop so entry starts to '.' and not '..'
|
||||
// But old code did that, so keep this for compatibility.
|
||||
++*offset;
|
||||
|
||||
for (cell i = 0; i < *offset; ++i)
|
||||
{
|
||||
if (FindNextFile(m_dir, &m_fd) == 0)
|
||||
{
|
||||
*offset = 0;
|
||||
FindClose(m_dir);
|
||||
m_dir = INVALID_HANDLE_VALUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (FindNextFile(m_dir, &m_fd) == 0)
|
||||
if (FindNextFile(m_dir, &m_fd) == 0)
|
||||
{
|
||||
FindClose(m_dir);
|
||||
m_dir = INVALID_HANDLE_VALUE;
|
||||
@@ -90,22 +78,7 @@ void CDirectory::NextEntry(cell* offset)
|
||||
|
||||
#elif defined PLATFORM_POSIX
|
||||
|
||||
if (offset)
|
||||
{
|
||||
seekdir(m_dir, *offset);
|
||||
|
||||
if (!(m_ep = readdir(m_dir)))
|
||||
{
|
||||
*offset = 0;
|
||||
closedir(m_dir);
|
||||
m_dir = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
*offset = telldir(m_dir);
|
||||
}
|
||||
}
|
||||
else if (!(m_ep = readdir(m_dir)))
|
||||
if (!(m_ep = readdir(m_dir)))
|
||||
{
|
||||
closedir(m_dir);
|
||||
m_dir = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user