MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / ExtractEroFS

Function ExtractEroFS

Source/Tools/FEXRootFSFetcher/Main.cpp:1080–1107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1078}
1079
1080bool ExtractEroFS(const fextl::string& Path, const fextl::string& RootFS, const fextl::string& FolderName) {
1081 auto TargetFolder = Path + FolderName;
1082
1083 std::error_code ec;
1084 if (std::filesystem::exists(TargetFolder, ec)) {
1085 fextl::string Question = "Target folder \"" + FolderName + "\" already exists. Overwrite?";
1086 if (AskForConfirmation(Question)) {
1087 if (std::filesystem::remove_all(TargetFolder, ec) == ~0ULL) {
1088 ExecWithInfo("Couldn't remove previous directory. Won't extract.");
1089 return false;
1090 }
1091 } else {
1092 return false;
1093 }
1094 }
1095
1096 ExecWithInfo("Extracting Erofs. This might take a few minutes.");
1097
1098 const auto ExtractOption = fmt::format("--extract={}", TargetFolder);
1099 const std::array<const char*, 4> ExecveArgs = {
1100 "fsck.erofs",
1101 ExtractOption.c_str(),
1102 RootFS.c_str(),
1103 nullptr,
1104 };
1105
1106 return Exec::ExecAndWaitForResponse(ExecveArgs[0], const_cast<char* const*>(ExecveArgs.data())) == 0;
1107}
1108} // namespace UnSquash
1109
1110int main(int argc, char** argv, char** const envp) {

Callers

nothing calls this directly

Calls 4

AskForConfirmationFunction · 0.85
ExecWithInfoFunction · 0.85
formatFunction · 0.85
ExecAndWaitForResponseFunction · 0.85

Tested by

no test coverage detected