MCPcopy Create free account
hub / github.com/comaps/comaps / GetFilePathsToLoadFromKmz

Function GetFilePathsToLoadFromKmz

libs/map/bookmark_helpers.cpp:464–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464std::vector<std::string> GetFilePathsToLoadFromKmz(std::string const & filePath)
465{ // Extract KML files from KMZ archive and save to temp KMLs with unique name.
466 std::vector<std::string> kmlFilePaths;
467 try
468 {
469 ZipFileReader::FileList files;
470 ZipFileReader::FilesList(filePath, files);
471 files.erase(std::remove_if(files.begin(), files.end(),
472 [](auto const & file) { return GetLowercaseFileExt(file.first) != kKmlExtension; }),
473 files.end());
474 for (auto const & [kmlFileInZip, size] : files)
475 {
476 auto const name = base::FileNameFromFullPath(kmlFileInZip);
477 auto fileSavePath = GenerateValidAndUniqueFilePathForKML(name);
478 ZipFileReader::UnzipFile(filePath, kmlFileInZip, fileSavePath);
479 kmlFilePaths.push_back(std::move(fileSavePath));
480 }
481 }
482 catch (RootException const & e)
483 {
484 LOG(LWARNING, ("Error unzipping file", filePath, e.Msg()));
485 }
486 return kmlFilePaths;
487}
488
489std::vector<std::string> GetFilePathsToLoadFromKmb(std::string const & filePath)
490{ // Convert input file and save to temp KML with unique name.

Callers 1

Calls 7

GetLowercaseFileExtFunction · 0.85
FileNameFromFullPathFunction · 0.85
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected