This repository was archived by the owner on May 11, 2026. It is now read-only.
forked from Dmitry666/HTTPCommandService
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdirectoryinfo.cpp
More file actions
93 lines (77 loc) · 1.92 KB
/
Copy pathdirectoryinfo.cpp
File metadata and controls
93 lines (77 loc) · 1.92 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "directoryinfo.h"
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
//inline bool is_directory( file_status f ) { return f.type() == directory_file; }
//inline bool exists( file_status f ) { return f.type() != status_unknown && f.type() != file_not_found; }
namespace openrc {
DirectoryInfo :: DirectoryInfo(const std::string& path)
: _path(path)
{}
DirectoryInfo :: ~DirectoryInfo()
{}
bool DirectoryInfo :: IsExist()
{
return true; //return boost::filesystem::exists(_path);
}
bool DirectoryInfo :: Create()
{
#if 0
namespace fs = boost::filesystem;
fs::path dir(_path);
try
{
fs::create_directories(dir);
}
catch(std::exception& e)
{
printf("Create directory '%s'. Exception %s", _path.c_str(), e.what());
return false;
}
#endif
return true;
}
std::vector<FileInfo> DirectoryInfo::GetFiles() const
{
std::vector<FileInfo> files;
//#if 0
fs::path someDir(_path.c_str());
fs::directory_iterator end_iter;
if (fs::exists(someDir) && fs::is_directory(someDir))
{
for (fs::directory_iterator dir_iter(someDir); dir_iter != end_iter; ++dir_iter)
{
if (fs::is_regular_file(dir_iter->status()))
{
std::string path = dir_iter->path().string();
files.push_back(FileInfo(path.c_str()));
}
}
}
//#endif
return files;
}
bool DirectoryInfo :: CreatePath(const std::string& path)
{
#if 0
namespace fs = boost::filesystem;
fs::path dir(path);
try
{
fs::create_directories(dir);
}
catch(std::exception& e)
{
printf("Create directory '%s'. Exception %s", path.c_str(), e.what());
return false;
}
#endif
return true;
}
bool DirectoryInfo::IsExist(const std::string& directoryPath)
{
#if 0
return boost::filesystem::exists(directoryPath);
#endif
return true;
}
} // End http.