std::string -> boost::filesystem::path

This commit is contained in:
Patrick Niklaus 2016-03-23 16:13:36 +01:00
parent 17adeaf3e2
commit 4e854399b6
3 changed files with 19 additions and 21 deletions

View File

@ -228,13 +228,13 @@ class InternalDataFacade final : public BaseDataFacade
}
}
void LoadDatasourceInfo(const std::string &datasource_names_file,
const std::string &datasource_indexes_file)
void LoadDatasourceInfo(const boost::filesystem::path &datasource_names_file,
const boost::filesystem::path &datasource_indexes_file)
{
boost::filesystem::ifstream datasources_stream(datasource_indexes_file, std::ios::binary);
if (!datasources_stream)
{
throw util::exception("Could not open " + datasource_indexes_file + " for reading!");
throw util::exception("Could not open " + datasource_indexes_file.string() + " for reading!");
}
BOOST_ASSERT(datasources_stream);
@ -251,7 +251,7 @@ class InternalDataFacade final : public BaseDataFacade
boost::filesystem::ifstream datasourcenames_stream(datasource_names_file, std::ios::binary);
if (!datasourcenames_stream)
{
throw util::exception("Could not open " + datasource_names_file + " for reading!");
throw util::exception("Could not open " + datasource_names_file.string() + " for reading!");
}
BOOST_ASSERT(datasourcenames_stream);
std::string name;

View File

@ -3,8 +3,6 @@
#include <boost/filesystem/path.hpp>
#include <string>
namespace osrm
{
namespace storage
@ -15,18 +13,18 @@ struct StorageConfig
StorageConfig(const boost::filesystem::path &base);
bool IsValid() const;
std::string ram_index_path;
std::string file_index_path;
std::string hsgr_data_path;
std::string nodes_data_path;
std::string edges_data_path;
std::string core_data_path;
std::string geometries_path;
std::string timestamp_path;
std::string datasource_names_path;
std::string datasource_indexes_path;
std::string names_data_path;
std::string properties_path;
boost::filesystem::path ram_index_path;
boost::filesystem::path file_index_path;
boost::filesystem::path hsgr_data_path;
boost::filesystem::path nodes_data_path;
boost::filesystem::path edges_data_path;
boost::filesystem::path core_data_path;
boost::filesystem::path geometries_path;
boost::filesystem::path timestamp_path;
boost::filesystem::path datasource_names_path;
boost::filesystem::path datasource_indexes_path;
boost::filesystem::path names_data_path;
boost::filesystem::path properties_path;
};
}
}

View File

@ -126,7 +126,7 @@ int Storage::Run()
auto shared_layout_ptr = new (layout_memory->Ptr()) SharedDataLayout();
shared_layout_ptr->SetBlockSize<char>(SharedDataLayout::FILE_INDEX_PATH,
config.file_index_path.length() + 1);
config.file_index_path.string().length() + 1);
// collect number of elements to store in shared memory object
util::SimpleLogger().Write() << "load names from: " << config.names_data_path;
@ -316,7 +316,7 @@ int Storage::Run()
file_index_path_ptr +
shared_layout_ptr->GetBlockSize(SharedDataLayout::FILE_INDEX_PATH),
0);
std::copy(config.file_index_path.begin(), config.file_index_path.end(), file_index_path_ptr);
std::copy(config.file_index_path.string().begin(), config.file_index_path.string().end(), file_index_path_ptr);
// Loading street names
unsigned *name_offsets_ptr = shared_layout_ptr->GetBlockPtr<unsigned, true>(
@ -528,7 +528,7 @@ int Storage::Run()
boost::filesystem::ifstream profile_properties_stream(config.properties_path);
if (!profile_properties_stream)
{
util::exception("Could not open " + config.properties_path + " for reading!");
util::exception("Could not open " + config.properties_path.string() + " for reading!");
}
profile_properties_stream.read(reinterpret_cast<char*>(profile_properties_ptr), sizeof(extractor::ProfileProperties));