mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 04:00:34 +00:00
Treat data file paths as relative to the metadata file
The data file paths are actually not native paths but URLs, this covers most cases but not all of them.
This commit is contained in:
parent
5c442c8aae
commit
598fa283b8
@ -63,6 +63,7 @@ std::vector<IONMetadataStdFileSource::sptr> GnssMetadataHandler::make_stream_sou
|
||||
}))
|
||||
{
|
||||
auto source = gnss_make_shared<IONMetadataStdFileSource>(
|
||||
metadata_filepath_,
|
||||
file,
|
||||
block,
|
||||
stream_ids);
|
||||
@ -88,6 +89,7 @@ std::vector<IONMetadataStdFileSource::sptr> GnssMetadataHandler::make_stream_sou
|
||||
|
||||
|
||||
IONMetadataStdFileSource::IONMetadataStdFileSource(
|
||||
const std::filesystem::path& metadata_filepath,
|
||||
const GnssMetadata::File& file,
|
||||
const GnssMetadata::Block& block,
|
||||
const std::vector<std::string>& stream_ids)
|
||||
@ -98,7 +100,8 @@ IONMetadataStdFileSource::IONMetadataStdFileSource(
|
||||
file_metadata_(file),
|
||||
block_metadata_(block)
|
||||
{
|
||||
fd_ = std::fopen(file.Url().Value().c_str(), "rb");
|
||||
std::filesystem::path data_filepath = metadata_filepath.parent_path() / file.Url().Value();
|
||||
fd_ = std::fopen(data_filepath.c_str(), "rb");
|
||||
std::size_t block_offset = file.Offset();
|
||||
std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET);
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/sync_block.h>
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
class chunk_data_t
|
||||
{
|
||||
@ -268,6 +269,7 @@ public:
|
||||
using sptr = gnss_shared_ptr<IONMetadataStdFileSource>;
|
||||
|
||||
IONMetadataStdFileSource(
|
||||
const std::filesystem::path& metadata_filepath,
|
||||
const GnssMetadata::File& file,
|
||||
const GnssMetadata::Block& block,
|
||||
const std::vector<std::string>& stream_ids);
|
||||
|
Loading…
Reference in New Issue
Block a user