FS helpers #604

Merged
muellerr merged 9 commits from core_ctrl_fs_helpers into develop 2023-04-16 02:57:16 +02:00
Showing only changes of commit 143002de48 - Show all commits

View File

@ -993,6 +993,7 @@ ReturnValue_t CoreController::actionListDirectoryDumpDirectly(ActionId_t actionI
const char *repoName = parser.getRepoName(repoNameLen); const char *repoName = parser.getRepoName(repoNameLen);
oss << " " << repoName << " > " << LIST_DIR_DUMP_WORK_FILE; oss << " " << repoName << " > " << LIST_DIR_DUMP_WORK_FILE;
sif::info << "Executing " << oss.str() << " for direct dump" << std::endl;
int ret = std::system(oss.str().c_str()); int ret = std::system(oss.str().c_str());
if (ret != 0) { if (ret != 0) {
utility::handleSystemError(result, "CoreController::actionListDirectoryDumpDirectly"); utility::handleSystemError(result, "CoreController::actionListDirectoryDumpDirectly");
@ -1017,7 +1018,10 @@ ReturnValue_t CoreController::actionListDirectoryDumpDirectly(ActionId_t actionI
} }
} }
std::array<uint8_t, 1024> dirListingBuf{}; std::array<uint8_t, 1024> dirListingBuf{};
std::ifstream ifile("/tmp/dir_listing.tmp", std::ios::binary); std::ifstream ifile(LIST_DIR_DUMP_WORK_FILE, std::ios::binary);
if (ifile.bad()) {
return returnvalue::FAILED;
}
std::error_code e; std::error_code e;
size_t totalFileSize = std::filesystem::file_size(LIST_DIR_DUMP_WORK_FILE, e); size_t totalFileSize = std::filesystem::file_size(LIST_DIR_DUMP_WORK_FILE, e);
size_t dumpedBytes = 0; size_t dumpedBytes = 0;