-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileSystem.h
54 lines (38 loc) · 1.1 KB
/
FileSystem.h
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
44
45
46
47
48
49
50
51
52
53
54
/**************************************************************************
* @file: FileSystem.h
* @brief: std::filesystem adapter
*
* Copyright (c) 2022 O-Net Communications Inc.
*************************************************************************/
#pragma once
#if defined(_WIN32)
#include <filesystem>
namespace fs = std::filesystem;
#elif __has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#elif __has_include(<experimental/filesystem>)
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
#error "no filesystem support!"
#endif
namespace cppbase { namespace filesystem {
constexpr const char LogConfigFilename[] = "log.conf";
constexpr const char ConfigFolderName[] = "config";
inline std::string GetConfigDir() noexcept
{
auto path = fs::current_path() / ConfigFolderName;
return path.string();
}
inline std::string GetWorkspaceDir() noexcept
{
// For debug only
return "./workspace";
}
inline std::string GetLogDir() noexcept
{
// For debug only
return "./log";
}
}} // namespace cppbase::filesystem