mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 09:58:54 +00:00
Adding getSystemRoot function (#2386)
Adding a cross platform function for getting the OS root and returning it as a boost::fs::path
This commit is contained in:
parent
1b75972181
commit
fe7b8d98f9
@ -185,6 +185,19 @@ Status resolveFilePattern(const boost::filesystem::path& pattern,
|
|||||||
std::vector<std::string>& results,
|
std::vector<std::string>& results,
|
||||||
GlobLimits setting);
|
GlobLimits setting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the OS root system directory.
|
||||||
|
*
|
||||||
|
* Some applications store configuration and application data inside of the
|
||||||
|
* Windows directory. This function retrieves the path to the current
|
||||||
|
* configurations Windows location.
|
||||||
|
*
|
||||||
|
* On POSIX systems this returns "/".
|
||||||
|
*
|
||||||
|
* @return an instance of fs::path, containing the OS root location.
|
||||||
|
*/
|
||||||
|
boost::filesystem::path getSystemRoot();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Transform a path with SQL wildcards to globbing wildcard.
|
* @brief Transform a path with SQL wildcards to globbing wildcard.
|
||||||
*
|
*
|
||||||
|
@ -295,6 +295,16 @@ Status resolveFilePattern(const fs::path& fs_path,
|
|||||||
return Status(0, "OK");
|
return Status(0, "OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fs::path getSystemRoot() {
|
||||||
|
#ifdef WIN32
|
||||||
|
char winDirectory[MAX_PATH] = {0};
|
||||||
|
GetWindowsDirectory(winDirectory, MAX_PATH);
|
||||||
|
return fs::path(winDirectory);
|
||||||
|
#else
|
||||||
|
return fs::path("/");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
inline void replaceGlobWildcards(std::string& pattern, GlobLimits limits) {
|
inline void replaceGlobWildcards(std::string& pattern, GlobLimits limits) {
|
||||||
// Replace SQL-wildcard '%' with globbing wildcard '*'.
|
// Replace SQL-wildcard '%' with globbing wildcard '*'.
|
||||||
if (pattern.find("%") != std::string::npos) {
|
if (pattern.find("%") != std::string::npos) {
|
||||||
|
@ -32,21 +32,23 @@ function check_format() {
|
|||||||
|
|
||||||
function audit() {
|
function audit() {
|
||||||
log "Running various code/change audits!"
|
log "Running various code/change audits!"
|
||||||
|
|
||||||
|
echo ""
|
||||||
log "Initializing and updating all submodules"
|
log "Initializing and updating all submodules"
|
||||||
checkout_thirdparty
|
checkout_thirdparty
|
||||||
|
|
||||||
# Check the docs creation
|
|
||||||
echo ""
|
echo ""
|
||||||
log "Running: make docs"
|
log "Running: make format"
|
||||||
make docs
|
check_format
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
log "Running: make check"
|
log "Running: make check"
|
||||||
make check
|
make check
|
||||||
|
|
||||||
|
# Check the docs creation
|
||||||
echo ""
|
echo ""
|
||||||
log "Running: make format"
|
log "Running: make docs"
|
||||||
check_format
|
make docs
|
||||||
}
|
}
|
||||||
|
|
||||||
audit
|
audit
|
||||||
|
Loading…
Reference in New Issue
Block a user