Updated file transfer system

This commit is contained in:
Roel Algaba Brizuela 2021-07-16 15:37:14 +02:00 committed by bernat
parent 66cd52b7e8
commit 3c89b03c54
2 changed files with 12 additions and 11 deletions

View File

@ -188,9 +188,12 @@ namespace detail {
if (download) {
// For each required file, check if it exists and request it otherwise
for(auto requiredFile : requiredFiles) {
if(!FileTransfer::FileExists(requiredFile)) {
for (auto requiredFile : requiredFiles) {
if (!FileTransfer::FileExists(requiredFile)) {
RequestFile(requiredFile);
log_info("Could not find the required file in cache, downloading... ", requiredFile);
} else {
log_info("Found the required file in cache! ", requiredFile)
}
}
}

View File

@ -157,11 +157,10 @@ namespace detail {
std::string map_name;
std::string map_base_path;
bool fill_base_string = false;
for(int i = map_info.name.size() - 1; i >= 0; --i){
if(fill_base_string == false && map_info.name[i] != '/'){
for (int i = map_info.name.size() - 1; i >= 0; --i) {
if (fill_base_string == false && map_info.name[i] != '/') {
map_name += map_info.name[i];
}
else {
} else {
map_base_path += map_info.name[i];
fill_base_string = true;
}
@ -169,12 +168,11 @@ namespace detail {
std::reverse(map_name.begin(), map_name.end());
std::reverse(map_base_path.begin(), map_base_path.end());
std::string XODRFolder = map_base_path + "/OpenDrive/" + map_name + ".xodr";
if(FileTransfer::FileExists(XODRFolder) == false){
_client.GetRequiredFiles();
_open_drive_file = _client.GetMapData();
_cached_map = MakeShared<Map>(map_info, _open_drive_file);
}
if (FileTransfer::FileExists(XODRFolder) == false) _client.GetRequiredFiles();
_open_drive_file = _client.GetMapData();
_cached_map = MakeShared<Map>(map_info, _open_drive_file);
}
return _cached_map;
}