bookmarks will be place in the same location as settings.ini from this moment.

This commit is contained in:
ExMix 2014-04-24 12:53:54 +03:00 committed by Alex Zolotarev
parent b8c4c80bfc
commit 83f5a5b563
5 changed files with 10 additions and 10 deletions

View file

@ -768,12 +768,12 @@ bool BookmarkCategory::SaveToKMLFile()
// If m_file doesn't match name, assign new m_file for this category and save old file name.
if (m_file.substr(i1, i2 - i1).find(name) != 0)
{
oldFile = GenerateUniqueFileName(GetPlatform().WritableDir(), name);
oldFile = GenerateUniqueFileName(GetPlatform().SettingsDir(), name);
m_file.swap(oldFile);
}
}
else
m_file = GenerateUniqueFileName(GetPlatform().WritableDir(), name);
m_file = GenerateUniqueFileName(GetPlatform().SettingsDir(), name);
string const fileTmp = m_file + ".tmp";

View file

@ -155,7 +155,7 @@ void BookmarkManager::LoadBookmarks()
{
ClearItems();
string const dir = GetPlatform().WritableDir();
string const dir = GetPlatform().SettingsDir();
Platform::FilesList files;
Platform::GetFilesByExt(dir, BOOKMARKS_FILE_EXTENSION, files);

View file

@ -486,7 +486,7 @@ string const GetFileName(string const & filePath)
string const GenerateValidAndUniqueFilePathForKML(string const & fileName)
{
string filePath = BookmarkCategory::RemoveInvalidSymbols(fileName);
filePath = BookmarkCategory::GenerateUniqueFileName(GetPlatform().WritableDir(), filePath);
filePath = BookmarkCategory::GenerateUniqueFileName(GetPlatform().SettingsDir(), filePath);
return filePath;
}

View file

@ -197,7 +197,7 @@ UNIT_TEST(Bookmarks_ExportKML)
TEST(!my::GetFileSize(BOOKMARKS_FILE_NAME, dummy), ());
// MapName is the <name> tag in test kml data.
string const catFileName = GetPlatform().WritableDir() + "MapName.kml";
string const catFileName = GetPlatform().SettingsDir() + "MapName.kml";
cat2.reset(BookmarkCategory::CreateFromKMLFile(catFileName));
CheckBookmarks(*cat2);
TEST(my::DeleteFileX(catFileName), ());
@ -207,7 +207,7 @@ namespace
{
template <size_t N> void DeleteCategoryFiles(char const * (&arrFiles)[N])
{
string const path = GetPlatform().WritableDir();
string const path = GetPlatform().SettingsDir();
for (size_t i = 0; i < N; ++i)
FileWriter::DeleteFileX(path + arrFiles[i] + BOOKMARKS_FILE_EXTENSION);
}
@ -624,7 +624,7 @@ bool AlmostEqual(double const & a, double const & b)
UNIT_TEST(TrackParsingTest_1)
{
string const KML = GetPlatform().WritablePathForFile("kml-with-track-kml.test");
string const KML = GetPlatform().SettingsPathForFile("kml-with-track-kml.test");
BookmarkCategory * cat = BookmarkCategory::CreateFromKMLFile(KML);
if (!cat)
TEST(false, ("Category can't be created"));
@ -647,7 +647,7 @@ UNIT_TEST(TrackParsingTest_1)
UNIT_TEST(TrackParsingTest_2)
{
string const KML = GetPlatform().WritablePathForFile("kml-with-track-from-google-earth.test");
string const KML = GetPlatform().SettingsPathForFile("kml-with-track-from-google-earth.test");
BookmarkCategory * cat = BookmarkCategory::CreateFromKMLFile(KML);
if (!cat)
TEST(false, ("Category can't be created"));

View file

@ -11,7 +11,7 @@
UNIT_TEST(Open_KMZ_Test)
{
string const KMZFILE = GetPlatform().WritablePathForFile("test.kmz");
string const KMZFILE = GetPlatform().SettingsPathForFile("test.kmz");
ZipFileReader::FileListT files;
ZipFileReader::FilesList(KMZFILE, files);
@ -27,7 +27,7 @@ UNIT_TEST(Open_KMZ_Test)
}
TEST(isKMLinZip, ("No KML file in KMZ"));
string const KMLFILE = GetPlatform().WritablePathForFile("newKml.kml");
string const KMLFILE = GetPlatform().SettingsPathForFile("newKml.kml");
MY_SCOPE_GUARD(fileGuard, bind(&FileWriter::DeleteFileX, KMLFILE));
ZipFileReader::UnzipFile(KMZFILE, "doc.kml", KMLFILE);