Hello, I’m trying to get an array of directories giving a path. I have search a lot, and I trying to use this function like this:
class FFillArrayDirectoryVisitor : public IPlatformFile::FDirectoryVisitor
{
public:
virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory) override
{
if (bIsDirectory)
{
Directories.Add(FilenameOrDirectory);
}
else
{
Files.Add(FilenameOrDirectory);
}
return true;
}
TArray<FName> Directories;
TArray<FString> Files;
};
bool UMODUtilities::GetSubFolders(FName Path, TArray<FName>& SubFolders)
{
TArray<FString> directoriesToSkip;
IPlatformFile &PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
FFillArrayDirectoryVisitor DirectoryVisitor;
const TCHAR* charPath = *Path.ToString();
PlatformFile.IterateDirectory(charPath, DirectoryVisitor);
SubFolders = DirectoryVisitor.Directories;
return false;
}
My problem is that when I use this script I get the following folders:
Android
HTML5
IOS
Linux
I can’t understand why I’m getting this, or maybe I’m misunderstanding something.
Any ideas? Thanks in advance.