From 4ca5af44cb26e7b24dfa18d8ccb9a35616e311a8 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Sun, 12 Dec 2021 14:51:52 -0800 Subject: [PATCH] Fix temporary database file deletion. --- impeller/archivist/archivist_fixture.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/impeller/archivist/archivist_fixture.cc b/impeller/archivist/archivist_fixture.cc index 7a80634114315..4bb0413a575ee 100644 --- a/impeller/archivist/archivist_fixture.cc +++ b/impeller/archivist/archivist_fixture.cc @@ -11,15 +11,15 @@ namespace testing { ArchivistFixture::ArchivistFixture() { std::stringstream stream; - stream << flutter::testing::GetCurrentTestName() << ".db"; - archive_file_name_ = fml::paths::JoinPaths( - {flutter::testing::GetFixturesPath(), stream.str()}); + stream << "Test" << flutter::testing::GetCurrentTestName() << ".db"; + archive_file_name_ = stream.str(); } ArchivistFixture::~ArchivistFixture() = default; const std::string ArchivistFixture::GetArchiveFileName() const { - return archive_file_name_; + return fml::paths::JoinPaths( + {flutter::testing::GetFixturesPath(), archive_file_name_}); } void ArchivistFixture::SetUp() { @@ -27,13 +27,14 @@ void ArchivistFixture::SetUp() { } void ArchivistFixture::TearDown() { - // TODO: Tear this down. For now, I am inspecting the files for readability of - // schema. - // DeleteArchiveFile(); + DeleteArchiveFile(); } void ArchivistFixture::DeleteArchiveFile() const { - fml::UnlinkFile(archive_file_name_.c_str()); + auto fixtures = flutter::testing::OpenFixturesDirectory(); + if (fml::FileExists(fixtures, archive_file_name_.c_str())) { + fml::UnlinkFile(fixtures, archive_file_name_.c_str()); + } } } // namespace testing