| 14 | using namespace boost::filesystem; |
| 15 | |
| 16 | int main(int argc, char* argv[]) |
| 17 | { |
| 18 | if (argc < 2) |
| 19 | { |
| 20 | cout << "Usage: tut2 path\n"; |
| 21 | return 1; |
| 22 | } |
| 23 | |
| 24 | path p(argv[1]); // avoid repeated path construction below |
| 25 | |
| 26 | if (exists(p)) // does path p actually exist? |
| 27 | { |
| 28 | if (is_regular_file(p)) // is path p a regular file? |
| 29 | cout << p << " size is " << file_size(p) << '\n'; |
| 30 | else if (is_directory(p)) // is path p a directory? |
| 31 | cout << p << " is a directory\n"; |
| 32 | else |
| 33 | cout << p << " exists, but is not a regular file or directory\n"; |
| 34 | } |
| 35 | else |
| 36 | cout << p << " does not exist\n"; |
| 37 | |
| 38 | return 0; |
| 39 | } |
nothing calls this directly
no test coverage detected