some error handling

This commit is contained in:
AustrianToast 2024-02-14 23:43:25 +01:00
parent 0ea4ce92f4
commit 55cd833288
No known key found for this signature in database
GPG Key ID: 5CD422268E489EB4

View File

@ -1,8 +1,23 @@
#include <cstddef>
#include <filesystem>
#include <iostream>
#include <string>
#include "fs_reader.h"
int main(int argc, char *argv[]) {
if (argc == 1) {
std::cout << "chksum: No path specified\n";
return 1;
}
if (argc > 2) {
std::cout << "chksum: Too many arguments\n";
return 1;
}
if (!fs::exists(argv[1])) {
std::cout << "chksum: Not a valid path\n";
return 1;
}
std::vector<fs::path> files_and_folders = find_all_files_and_folders(argv[1]);
for (size_t index = 0; index < files_and_folders.size(); index++) {