mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-06-28 16:03:15 +00:00
Handling error if logging directory can't be created
This commit is contained in:
parent
86bfb5447a
commit
aa18634c87
|
@ -35,6 +35,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
|
@ -146,12 +147,18 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
std::cout << "The path "
|
std::cout << "The path "
|
||||||
<< FLAGS_log_dir
|
<< FLAGS_log_dir
|
||||||
<< " does not exist, attempting to create it"
|
<< " does not exist, attempting to create it."
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
boost::filesystem::create_directory(p);
|
boost::system::error_code ec;
|
||||||
|
boost::filesystem::create_directory(p, ec);
|
||||||
|
if(ec != 0)
|
||||||
|
{
|
||||||
|
std::cout << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended." << std::endl;
|
||||||
|
google::ShutDownCommandLineFlags();
|
||||||
|
std::exit(0);
|
||||||
}
|
}
|
||||||
std::cout << "Logging with be done at "
|
}
|
||||||
<< FLAGS_log_dir << std::endl;
|
std::cout << "Logging with be done at " << FLAGS_log_dir << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ControlThread> control_thread(new ControlThread());
|
std::unique_ptr<ControlThread> control_thread(new ControlThread());
|
||||||
|
@ -169,6 +176,10 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
LOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e);
|
LOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e);
|
||||||
}
|
}
|
||||||
|
catch( boost::lock_error & le )
|
||||||
|
{
|
||||||
|
LOG(FATAL) << "Lock error exception: " << boost::diagnostic_information(le);
|
||||||
|
}
|
||||||
catch(std::exception const& ex)
|
catch(std::exception const& ex)
|
||||||
{
|
{
|
||||||
LOG(FATAL) << "STD exception: " << ex.what();
|
LOG(FATAL) << "STD exception: " << ex.what();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user