Add GetExecutablePath to utils/file
Reviewers: mferencevic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2713
This commit is contained in:
parent
fbdcad1106
commit
d0411510fa
@ -13,6 +13,10 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
std::filesystem::path GetExecutablePath() {
|
||||
return std::filesystem::read_symlink("/proc/self/exe");
|
||||
}
|
||||
|
||||
std::vector<std::string> ReadLines(const std::filesystem::path &path) noexcept {
|
||||
std::vector<std::string> lines;
|
||||
|
||||
|
@ -14,6 +14,12 @@
|
||||
|
||||
namespace utils {
|
||||
|
||||
/// Get the path of the current executable.
|
||||
///
|
||||
/// @throw std::filesystem::filesystem_error
|
||||
/// @throw std::bad_alloc
|
||||
std::filesystem::path GetExecutablePath();
|
||||
|
||||
/// Reads all lines from the file specified by path. If the file doesn't exist
|
||||
/// or there is an access error the function returns an empty list.
|
||||
std::vector<std::string> ReadLines(const std::filesystem::path &path) noexcept;
|
||||
|
Loading…
Reference in New Issue
Block a user