FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
wazuh/src/shared_modules/utils/fileSystem.hpp at fuzzing · postech-compsec/wazuh · GitHub
postech-compsec
/
wazuh
Public
forked from
wazuh/wazuh
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
wazuh
/
src
/
shared_modules
/
utils
/
fileSystem.hpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
80 lines (70 loc) · 2.42 KB
Breadcrumbs
wazuh
/
src
/
shared_modules
/
utils
/
fileSystem.hpp
Copy path
File metadata and controls
80 lines (70 loc) · 2.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/*
* Wazuh shared modules utils
* Copyright (C) 2015, Wazuh Inc.
* July 14, 2023.
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
* License (version 2) as published by the FSF - Free Software
* Foundation.
*/
#
ifndef
_FILESYSTEM_HELPER_HPP
#
define
_FILESYSTEM_HELPER_HPP
#
include
<
filesystem
>
/*
*
* @brief Helper class to manage filesystem operations
*/
template
<
typename
TDirectoryIterator = std::filesystem::directory_iterator>
class
RealFileSystemT
{
public:
/*
*
* @brief Check if a path exists
* @param path Path to check
* @return True if the path exists, false otherwise
*/
static
bool
exists
(
const
std::filesystem::path& path)
{
return
std::filesystem::exists
(path);
}
/*
*
* @brief Return the iterator to the first element of a directory
* @param path Path to check
* @return The iterator to the first element of a directory
*/
static
TDirectoryIterator
directory_iterator
(
const
std::filesystem::path& path)
{
return
TDirectoryIterator
(path);
}
/*
*
* @brief Is regular file
* @param path Path to check
* @return True if the path is a regular file, false otherwise
*/
static
bool
is_regular_file
(
const
std::filesystem::path& path)
{
return
std::filesystem::is_regular_file
(path);
}
/*
*
* @brief Is directory
* @param path Path to check
* @return True if the path is a directory, false otherwise
*/
static
bool
is_directory
(
const
std::filesystem::path& path)
{
return
std::filesystem::is_directory
(path);
}
/*
*
* @brief Get the full path of a file
* @param relativePath Relative path to the file
* @param fileName Name of the file
* @details This function resolves the full path of a file based on the provided relative path and the file name.
* @return The full path of the file as a string.
*/
static
std::string
resolvePath
(
const
std::string & fileName,
const
std::string & relativePath)
{
return
(
std::filesystem::path
(fileName).
parent_path
() / relativePath).
string
();
}
};
using
RealFileSystem = RealFileSystemT<>;
#
endif
//
_FILESYSTEM_HELPER_HPP
Back
|
FazBrowse Home
|
New Git URL