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

Method LoadMetadata

libs/map/bookmark_manager.cpp:1970–2004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1968}
1969
1970void BookmarkManager::LoadMetadata()
1971{
1972 CHECK_THREAD_CHECKER(m_threadChecker, ());
1973
1974 auto const metadataFilePath = base::JoinPath(GetPlatform().WritableDir(), kMetadataFileName);
1975 if (!Platform::IsFileExistsByFullPath(metadataFilePath))
1976 return;
1977
1978 Metadata metadata;
1979 std::string json;
1980
1981 try
1982 {
1983 FileReader(metadataFilePath).ReadAsString(json);
1984
1985 if (json.empty())
1986 return;
1987
1988 coding::DeserializerJson des(json);
1989 des(metadata);
1990 }
1991 catch (FileReader::Exception const & exception)
1992 {
1993 LOG(LWARNING, ("Exception while reading file:", metadataFilePath, "reason:", exception.what()));
1994 return;
1995 }
1996 catch (base::Json::Exception const & exception)
1997 {
1998 LOG(LWARNING, ("Exception while parsing file:", metadataFilePath, "reason:", exception.what(), "json:", json));
1999 return;
2000 }
2001
2002 m_metadata = metadata;
2003 m_metadata.m_categorySortType = NormalizeCategorySortType(m_metadata.m_categorySortType);
2004}
2005
2006BookmarkManager::KMLDataCollectionPtr BookmarkManager::LoadBookmarks(std::string const & dir, std::string_view ext,
2007 KmlFileType fileType,

Callers

nothing calls this directly

Calls 5

JoinPathFunction · 0.85
FileReaderClass · 0.50
ReadAsStringMethod · 0.45
emptyMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected