Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/Common/File/DirListing.h
3187 views
1
#pragma once
2
3
#include <string>
4
#include <string_view>
5
#include <vector>
6
#include <cstdio>
7
#include <cstdint>
8
9
#include "Common/File/Path.h"
10
11
namespace File {
12
13
struct FileInfo {
14
std::string name;
15
Path fullName;
16
bool exists = false;
17
bool isDirectory = false;
18
bool isWritable = false;
19
uint64_t size = 0;
20
21
uint64_t atime = 0;
22
uint64_t mtime = 0;
23
uint64_t ctime = 0;
24
uint32_t access = 0; // st_mode & 0x1ff
25
26
bool operator <(const FileInfo &other) const;
27
};
28
29
bool GetFileInfo(const Path &path, FileInfo *fileInfo);
30
31
enum {
32
GETFILES_GETHIDDEN = 1,
33
GETFILES_GET_NAVIGATION_ENTRIES = 2, // If you don't set this, "." and ".." will be skipped.
34
};
35
36
// Note: extensionFilter is ignored for directories, so you can recurse.
37
bool GetFilesInDir(const Path &directory, std::vector<FileInfo> *files, const char *extensionFilter = nullptr, int flags = 0, std::string_view prefix = std::string_view());
38
std::vector<File::FileInfo> ApplyFilter(std::vector<File::FileInfo> files, const char *extensionFilter, std::string_view prefix);
39
40
#ifdef _WIN32
41
std::vector<std::string> GetWindowsDrives();
42
#endif
43
44
} // namespace File
45
46