Files
comaps/platform/platform_tests_support/scoped_dir.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

44 lines
975 B
C++

#pragma once
#include "platform/platform.hpp"
#include "base/macros.hpp"
#include <string>
namespace platform
{
namespace tests_support
{
// Scoped test directory in a writable dir.
class ScopedDir
{
public:
/// Creates test dir in a writable directory.
/// @param path Path for a testing directory, should be relative to writable-dir.
ScopedDir(std::string const & relativePath);
ScopedDir(ScopedDir const & parent, std::string const & name);
~ScopedDir();
void Reset() { m_reset = true; }
std::string const & GetFullPath() const { return m_fullPath; }
std::string const & GetRelativePath() const { return m_relativePath; }
bool Exists() const { return GetPlatform().IsFileExistsByFullPath(GetFullPath()); }
private:
std::string const m_fullPath;
std::string const m_relativePath;
bool m_reset;
DISALLOW_COPY_AND_MOVE(ScopedDir);
};
std::string DebugPrint(ScopedDir const & dir);
} // namespace tests_support
} // namespace platform