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

Function UnsquashRootFS

Source/Tools/FEXRootFSFetcher/Main.cpp:1057–1078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1055
1056namespace UnSquash {
1057bool UnsquashRootFS(const fextl::string& Path, const fextl::string& RootFS, const fextl::string& FolderName) {
1058 auto TargetFolder = Path + FolderName;
1059
1060 std::error_code ec;
1061 if (std::filesystem::exists(TargetFolder, ec)) {
1062 fextl::string Question = "Target folder \"" + FolderName + "\" already exists. Overwrite?";
1063 if (AskForConfirmation(Question)) {
1064 if (std::filesystem::remove_all(TargetFolder, ec) == ~0ULL) {
1065 ExecWithInfo("Couldn't remove previous directory. Won't extract.");
1066 return false;
1067 }
1068 } else {
1069 return false;
1070 }
1071 }
1072
1073 const std::array<const char*, 6> ExecveArgs = {
1074 "unsquashfs", "-f", "-d", TargetFolder.c_str(), RootFS.c_str(), nullptr,
1075 };
1076
1077 return Exec::ExecAndWaitForResponse(ExecveArgs[0], const_cast<char* const*>(ExecveArgs.data())) == 0;
1078}
1079
1080bool ExtractEroFS(const fextl::string& Path, const fextl::string& RootFS, const fextl::string& FolderName) {
1081 auto TargetFolder = Path + FolderName;

Callers

nothing calls this directly

Calls 3

AskForConfirmationFunction · 0.85
ExecWithInfoFunction · 0.85
ExecAndWaitForResponseFunction · 0.85

Tested by

no test coverage detected