From 16e8051557f59c064ee1e11682f38d23a821c9fb Mon Sep 17 00:00:00 2001 From: Nicholas O'Connor Date: Sun, 12 Mar 2017 22:33:42 -0700 Subject: [PATCH] actually using and building it --- src/Makefile.am | 2 +- src/cellar.cpp | 29 +++++++++++------------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 157de51..84f7aaf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ bin_PROGRAMS = cellar cellar_CPPFLAGS = $(BOOST_CPPFLAGS) cellar_LDFLAGS = $(BOOST_LDFLAGS) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB) -cellar_SOURCES = cellar.cpp +cellar_SOURCES = cellar.cpp fs.cpp diff --git a/src/cellar.cpp b/src/cellar.cpp index 07025a7..768108d 100644 --- a/src/cellar.cpp +++ b/src/cellar.cpp @@ -1,28 +1,21 @@ +#include #include #include +#include #include #include -namespace fs = boost::filesystem; +#include "fs.hpp" + +using namespace std; int main(int argc, char* argv[]) { - fs::path cwd(fs::current_path()); - cwd = fs::system_complete("."); - fs::directory_iterator iter_end; - - for (fs::directory_iterator iter_cwd(cwd); iter_cwd != iter_end; ++iter_cwd) { - try { - std::string item = iter_cwd->path().filename().native(); - - std::cout << item; - std::cout << " "; - } - catch (const std::exception& exc) { - std::cout << "fuck" << std::endl; - return 1; - } - } - std::cout << std::endl; + vector homedir = cellar::fs::listdir(getenv("HOME")); + for (string item : homedir) { + cout << item; + cout << " "; + } + cout << endl; return 0; }