| 1055 | |
| 1056 | namespace UnSquash { |
| 1057 | bool 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 | |
| 1080 | bool ExtractEroFS(const fextl::string& Path, const fextl::string& RootFS, const fextl::string& FolderName) { |
| 1081 | auto TargetFolder = Path + FolderName; |
nothing calls this directly
no test coverage detected