Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/engine/qcommon/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ bool FS_FileExists(const char* path)
return FS::PakPath::FileExists(path) || FS::HomePath::FileExists(path);
}

std::set<std::string> usedFiles;

int FS_FOpenFileRead(const char* path, fileHandle_t* handle, bool)
{
if (!handle)
Expand All @@ -96,6 +98,7 @@ int FS_FOpenFileRead(const char* path, fileHandle_t* handle, bool)
int length = -1;
std::error_code err;
if (FS::PakPath::FileExists(path)) {
usedFiles.insert(path);
handleTable[*handle].fileData = FS::PakPath::ReadFile(path, err);
if (!err) {
handleTable[*handle].filePos = 0;
Expand Down Expand Up @@ -749,6 +752,25 @@ class WhichCmd: public Cmd::StaticCmd {
};
static WhichCmd WhichCmdRegistration;

class ListUsedFilesCmd : public Cmd::StaticCmd {
public:
ListUsedFilesCmd()
: Cmd::StaticCmd("listUsedFiles", Cmd::SYSTEM, "list used files from pak path") {}

void Run(const Cmd::Args& args) const override
{
if (args.Argc() != 1) {
PrintUsage(args, "", "");
return;
}

for (auto filename : usedFiles) {
Print("%s", filename);
}
}
};
static ListUsedFilesCmd ListFilesCmdRegistration;

class ListPathsCmd: public Cmd::StaticCmd {
public:
ListPathsCmd()
Expand Down