mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-29 22:42:59 +00:00 
			
		
		
		
	Handling error if logging directory can't be created
This commit is contained in:
		| @@ -35,6 +35,7 @@ | ||||
| #endif | ||||
|  | ||||
| #include <ctime> | ||||
| #include <cstdlib> | ||||
| #include <memory> | ||||
| #include <queue> | ||||
| #include <boost/exception/diagnostic_information.hpp> | ||||
| @@ -145,13 +146,19 @@ int main(int argc, char** argv) | ||||
|             if (!boost::filesystem::exists(p)) | ||||
|                 { | ||||
|                     std::cout << "The path " | ||||
|                         << FLAGS_log_dir | ||||
|                         << " does not exist, attempting to create it" | ||||
|                         << std::endl; | ||||
|                     boost::filesystem::create_directory(p); | ||||
|                               << FLAGS_log_dir | ||||
|                               << " does not exist, attempting to create it." | ||||
|                               << std::endl; | ||||
|                     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()); | ||||
| @@ -169,6 +176,10 @@ int main(int argc, char** argv) | ||||
|     { | ||||
|             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) | ||||
|     { | ||||
|             LOG(FATAL) << "STD exception: " << ex.what(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez