Mercurial > thymian
comparison templates/main.cpp @ 0:a4671277546c tip
created the repository for the thymian project
| author | ferencd |
|---|---|
| date | Tue, 17 Aug 2021 11:19:54 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:a4671277546c |
|---|---|
| 1 #include "templater.h" | |
| 2 | |
| 3 #include <algorithm> | |
| 4 #include <iostream> | |
| 5 | |
| 6 #define BOOST_FILESYSTEM_NO_DEPRECATED | |
| 7 #define BOOST_FILESYSTEM_VERSION 3 | |
| 8 | |
| 9 #include <iostream> | |
| 10 #include "boost/filesystem.hpp" | |
| 11 | |
| 12 using namespace std; | |
| 13 using namespace boost::filesystem; | |
| 14 | |
| 15 int main(int argc, char *argv[]) | |
| 16 { | |
| 17 // list all files in current directory. | |
| 18 //You could put any file path in here, e.g. "/home/me/mwah" to list that directory | |
| 19 path p (TEMPLATES_DIRECTORY); | |
| 20 | |
| 21 directory_iterator end_itr; | |
| 22 | |
| 23 // cycle through the directory | |
| 24 for (directory_iterator itr(p); itr != end_itr; ++itr) | |
| 25 { | |
| 26 // If it's not a directory, list it. If you want to list directories too, just remove this check. | |
| 27 if (is_regular_file(itr->path())) { | |
| 28 // assign current file name to current_file and echo it out to the console. | |
| 29 string current_file = itr->path().string(); | |
| 30 cout << current_file << endl; | |
| 31 } | |
| 32 } | |
| 33 } |
