forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscoped_dir.hpp
43 lines (30 loc) · 975 Bytes
/
scoped_dir.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#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