1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-15 22:57:17 +00:00

Gives and informative message and exits the program when the source file is not found, instead of abort and core dumping

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@210 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez
2012-07-15 00:47:20 +00:00
parent c9a06f702a
commit d579d0d8e5

View File

@@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@@ -37,6 +37,7 @@
#include <iostream>
#include <fstream>
#include <iomanip>
#include <exception>
#include <gflags/gflags.h>
#include <glog/log_severity.h>
#include <glog/logging.h>
@@ -89,8 +90,31 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
<< " unrecognized item type. Using short.";
item_size_ = sizeof(short);
}
try
{
file_source_ = gr_make_file_source(item_size_, filename_.c_str(), repeat_);
}
catch (const std::exception &e)
{
std::cerr
<< "The receiver was configured to work with a file signal source "
<< std::endl
<< "but the specified file is unreachable by GNSS-SDR."
<< std::endl
<< "Please modify the configuration at "
<< "conf/gnss-sdr.conf (the default configuration file)"
<< std::endl
<< "and point SignalSource.filename to a valid file,"
<< std::endl
<< "or specify your own receiver and source with the flag"
<< std::endl
<<"gnss-sdr --config_file=my_GNSS_SDR_configuration"
<< std::endl;
LOG_AT_LEVEL(INFO) << "file_signal_source: Unable to open the samples file "
<< filename_.c_str() << ", exiting the program.";
exit(1);
}
DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")";
if (samples_ == 0)