some error handling
This commit is contained in:
parent
0ea4ce92f4
commit
55cd833288
15
src/main.cpp
15
src/main.cpp
@ -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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user