#include <iostream>
#include <string>

#include <boost/filesystem.hpp>
#include <boost/regex.hpp>

#include "PhotoCompressArchiver.hh"

// clang++ -std=c++11 -L. -l packjpg -I/opt/local/include -L/opt/local/lib 
//  -lboost_system-mt -lboost_regex-mt -lboost_filesystem-mt -o pca main.cc
int main(int argc, char** argv)
{
    std::cout << "Photo Compress Archiver -- v0.1.0" << std::endl;
    
    uint32_t num_cores = std::thread::hardware_concurrency();
    std::cout << "    [" << num_cores << " cores detected]\n" << std::endl;
    
    // Make sure the correct number of arguments were specified
    if (argc < 2)
    {
        std::cerr << "ERROR: Not enough arguments" << std::endl;
        return -1;
    }
    
    // Make sure that path specified actually exists
    if (! bfs::exists(argv[1]))
    {
        std::cerr << "ERROR: the path \"" << argv[1] << "\" does not exist" 
                  << std::endl;
        return -2;
    }
    
    auto pca = new PhotoCompressArchiver(argv[1], num_cores);
    pca->execute();
    
    //~ delete pca;
    
    return 0;
}
