mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 01:55:20 +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,
|
||||
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.
|
||||
*
|
||||
|
@ -295,6 +295,16 @@ Status resolveFilePattern(const fs::path& fs_path,
|
||||
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) {
|
||||
// Replace SQL-wildcard '%' with globbing wildcard '*'.
|
||||
if (pattern.find("%") != std::string::npos) {
|
||||
|
@ -32,21 +32,23 @@ function check_format() {
|
||||
|
||||
function audit() {
|
||||
log "Running various code/change audits!"
|
||||
|
||||
echo ""
|
||||
log "Initializing and updating all submodules"
|
||||
checkout_thirdparty
|
||||
|
||||
# Check the docs creation
|
||||
echo ""
|
||||
log "Running: make docs"
|
||||
make docs
|
||||
log "Running: make format"
|
||||
check_format
|
||||
|
||||
echo ""
|
||||
log "Running: make check"
|
||||
make check
|
||||
|
||||
# Check the docs creation
|
||||
echo ""
|
||||
log "Running: make format"
|
||||
check_format
|
||||
log "Running: make docs"
|
||||
make docs
|
||||
}
|
||||
|
||||
audit
|
||||
|
Loading…
Reference in New Issue
Block a user