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

Function BuildIndexFile

libs/map/bookmark_manager.cpp:127–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127std::string BuildIndexFile(std::vector<std::string> const & filesForIndex)
128{
129 std::string const filePath = base::JoinPath(GetPlatform().TmpDir(), "doc.kml");
130 FileWriter fileWriter(filePath);
131 std::string content =
132 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
133 "<kml xmlns=\"http://earth.google.com/kml/2.0\">\n"
134 "<Document>\n"
135 "<name>CoMaps Bookmarks and Tracks</name>\n";
136 for (auto const & fileName : filesForIndex)
137 {
138 content.append("<NetworkLink><name>");
139 content.append(base::GetNameFromFullPathWithoutExt(fileName));
140 content.append("</name><Link><href>");
141 content.append(fileName);
142 content.append("</href></Link></NetworkLink>\n");
143 }
144 content.append(
145 "</Document>\n"
146 "</kml>");
147 fileWriter.Write(content.c_str(), content.length());
148 return filePath;
149}
150
151BookmarkManager::SharingResult ExportMultipleFiles(BookmarkManager::KMLDataCollectionPtr collection)
152{

Callers 1

ExportMultipleFilesFunction · 0.85

Calls 6

JoinPathFunction · 0.85
TmpDirMethod · 0.80
lengthMethod · 0.80
appendMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected