2012-03-24 23:39:19 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
2021-02-28 13:46:08 +01:00
|
|
|
#include <cstdio>
|
2023-03-06 14:37:11 +01:00
|
|
|
#include <cstdint>
|
2014-04-08 15:26:47 +02:00
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
#include "Common/File/Path.h"
|
2012-09-17 21:21:34 +02:00
|
|
|
|
2021-04-25 20:38:22 +02:00
|
|
|
namespace File {
|
|
|
|
|
|
2013-07-04 10:37:16 +02:00
|
|
|
struct FileInfo {
|
2012-10-31 13:23:16 +01:00
|
|
|
std::string name;
|
2021-05-09 15:25:12 +02:00
|
|
|
Path fullName;
|
2021-05-06 01:31:38 +02:00
|
|
|
bool exists = false;
|
|
|
|
|
bool isDirectory = false;
|
|
|
|
|
bool isWritable = false;
|
|
|
|
|
uint64_t size = 0;
|
2012-11-01 09:45:27 +01:00
|
|
|
|
2021-07-18 16:00:07 +02:00
|
|
|
uint64_t atime = 0;
|
|
|
|
|
uint64_t mtime = 0;
|
|
|
|
|
uint64_t ctime = 0;
|
|
|
|
|
uint32_t access = 0; // st_mode & 0x1ff
|
2021-04-25 20:52:29 +02:00
|
|
|
|
2013-07-04 10:37:16 +02:00
|
|
|
bool operator <(const FileInfo &other) const;
|
2012-09-17 21:21:34 +02:00
|
|
|
};
|
|
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
bool GetFileInfo(const Path &path, FileInfo *fileInfo);
|
2014-03-12 19:49:03 +01:00
|
|
|
|
|
|
|
|
enum {
|
2021-02-28 13:46:08 +01:00
|
|
|
GETFILES_GETHIDDEN = 1,
|
2021-07-19 10:31:48 +02:00
|
|
|
GETFILES_GET_NAVIGATION_ENTRIES = 2, // If you don't set this, "." and ".." will be skipped.
|
2014-03-12 19:49:03 +01:00
|
|
|
};
|
2021-05-06 01:31:38 +02:00
|
|
|
|
2021-07-19 10:31:48 +02:00
|
|
|
bool GetFilesInDir(const Path &directory, std::vector<FileInfo> *files, const char *filter = nullptr, int flags = 0);
|
2021-05-16 00:38:12 +02:00
|
|
|
std::vector<File::FileInfo> ApplyFilter(std::vector<File::FileInfo> files, const char *filter);
|
2013-06-27 16:20:18 +02:00
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2021-04-25 20:57:37 +02:00
|
|
|
std::vector<std::string> GetWindowsDrives();
|
2013-07-04 10:37:16 +02:00
|
|
|
#endif
|
2021-04-25 20:38:22 +02:00
|
|
|
|
2021-05-06 01:31:38 +02:00
|
|
|
} // namespace File
|