| 1968 | } |
| 1969 | |
| 1970 | void 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 | |
| 2006 | BookmarkManager::KMLDataCollectionPtr BookmarkManager::LoadBookmarks(std::string const & dir, std::string_view ext, |
| 2007 | KmlFileType fileType, |
nothing calls this directly
no test coverage detected