vkdoom_m/src/common/filesystem/fs_findfile.h
Christoph Oelckers 5f3d25ef44 - use ScanDirectory in all places where the findfile API was used.
This allows to completely hide its implementation details from the rest of the code which only gets a list of file names now.
2023-08-22 21:49:54 +02:00

33 lines
710 B
C++

#pragma once
// Directory searching routines
#include <stdint.h>
#include <vector>
#include <string>
struct FileListEntry
{
std::string FileName; // file name only
std::string FilePath; // full path to file
std::string FilePathRel; // path relative to the scanned directory.
size_t Length = 0;
bool isDirectory = false;
bool isReadonly = false;
bool isHidden = false;
bool isSystem = false;
};
using FileList = std::vector<FileListEntry>;
bool ScanDirectory(std::vector<FileListEntry>& list, const char* dirpath, const char* match, bool nosubdir = false, bool readhidden = false);
inline void FixPathSeparator(char* path)
{
while (*path)
{
if (*path == '\\')
*path = '/';
path++;
}
}