Skip to content

Instantly share code, notes, and snippets.

@jpcima
Created March 14, 2020 16:07
Show Gist options
  • Select an option

  • Save jpcima/b57775a9e7636099dac52093df602338 to your computer and use it in GitHub Desktop.

Select an option

Save jpcima/b57775a9e7636099dac52093df602338 to your computer and use it in GitHub Desktop.
diff --git a/include/CNativeFileSystem.h b/include/CNativeFileSystem.h
index 338afd7..75f09f2 100644
--- a/include/CNativeFileSystem.h
+++ b/include/CNativeFileSystem.h
@@ -11,8 +11,6 @@
#include "IFileSystem.h"
-struct SDir;
-
namespace vfspp
{
CLASS_PTR(CNativeFile)
@@ -100,8 +98,10 @@ public:
virtual bool IsDir(const CFileInfo& dirPath) const override;
private:
+ typedef void* SDirHandle;
+
IFilePtr FindFile(const CFileInfo& fileInfo) const;
- void BuildFilelist(SDir* dir, std::string basePath, TFileList& outFileList);
+ void BuildFilelist(SDirHandle dirHandle, std::string basePath, TFileList& outFileList);
private:
std::string m_BasePath;
diff --git a/src/CNativeFileSystem.cpp b/src/CNativeFileSystem.cpp
index 4030498..398a122 100644
--- a/src/CNativeFileSystem.cpp
+++ b/src/CNativeFileSystem.cpp
@@ -20,7 +20,7 @@ using namespace vfspp;
// *****************************************************************************
const uint64_t kChunkSize = 1024;
-struct SDir : public DIR {};
+typedef DIR SDir;
// *****************************************************************************
// Public Methods
@@ -278,10 +278,12 @@ IFilePtr CNativeFileSystem::FindFile(const CFileInfo& fileInfo) const
return nullptr;
}
-void CNativeFileSystem::BuildFilelist(SDir* dir,
+void CNativeFileSystem::BuildFilelist(SDirHandle dirHandle,
std::string basePath,
TFileList& outFileList)
{
+ SDir* dir = static_cast<DIR*>(dirHandle);
+
if (!CStringUtils::EndsWith(basePath, "/"))
{
basePath += "/";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment