1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-10 20:10:05 +00:00

Cleaner exit if the data file is not found

This commit is contained in:
Carles Fernandez 2024-08-20 14:54:15 +02:00
parent 94e49fb2ec
commit 9bf3f457c3
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 9 additions and 4 deletions

View File

@ -18,6 +18,8 @@
#include "gnuradio/block.h"
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#if USE_GLOG_AND_GFLAGS
#include <glog/logging.h>
@ -25,8 +27,6 @@
#include <absl/log/log.h>
#endif
using namespace std::string_literals;
IONGSMSFileSource::IONGSMSFileSource(
const fs::path& metadata_filepath,
const GnssMetadata::File& file,
@ -46,7 +46,10 @@ IONGSMSFileSource::IONGSMSFileSource(
if (!file_stream_.is_open())
{
LOG(ERROR) << "ion_gsms_file_source: Unable to open the samples file: " << (data_filepath).c_str();
LOG(WARNING) << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str();
std::cerr << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str() << std::endl;
std::cout << "GNSS-SDR program ended.\n";
exit(1);
}
// Skip offset and block header
@ -96,11 +99,13 @@ std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index)
return output_stream_item_sizes_[stream_index];
}
std::size_t IONGSMSFileSource::output_stream_total_sample_count(std::size_t stream_index) const
{
return output_stream_total_sample_counts_[stream_index];
}
gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector<std::string>& stream_ids)
{
int nstreams = 0;
@ -142,6 +147,7 @@ gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetada
item_sizes);
}
int IONGSMSFileSource::work(
int noutput_items,
gr_vector_const_void_star& input_items __attribute__((unused)),

View File

@ -23,7 +23,6 @@
#include <gnuradio/block.h>
#include <gnuradio/sync_block.h>
#include <cstddef>
#include <cstdio>
#include <fstream>
#include <memory>
#include <string>