refactor: duplicated path helpers into common/path.hpp (#1249)

* refactor: duplicated path helpers into common/path.hpp

* update rocprof-sys-instrument to use shared path utility

* Add path::realpath(std::string[, std::string*]) helper function in common/path.hpp for binaries

* common: centralize remove_env implementation in environment.hpp

* remove unused includes from rocprof-sys binaries and argparse

* changing set to unordered_set wherever sorting is not required and additional cleanup

* review comment incorporated

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* copilot review for remove_env incorporated

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
habajpai-amd
2025-11-20 09:55:00 +05:30
committato da GitHub
parent 2e0e613397
commit b09834e784
15 ha cambiato i file con 165 aggiunte e 357 eliminazioni
@@ -22,7 +22,6 @@
#pragma once
#include <string>
#include <string_view>
#include <vector>
@@ -34,9 +33,6 @@ enum update_mode : int
UPD_WEAK = 1 << 2, // 0x04
};
std::string
get_realpath(const std::string& _fpath);
void
print_command(const std::vector<char*>& _argv);
@@ -46,22 +42,10 @@ print_updated_environment(std::vector<char*> _env);
std::vector<char*>
get_initial_environment();
std::string
get_rocprofsys_root(void);
std::string
get_internal_libpath(const std::string& _lib);
std::string
get_internal_script_path(void);
template <typename Tp>
void
update_env(std::vector<char*>& _environ, std::string_view _env_var, Tp&& _env_val,
update_mode&& _mode = UPD_REPLACE, std::string_view _join_delim = ":");
void
remove_env(std::vector<char*>& _environ, std::string_view _env_var);
std::vector<char*>
parse_args(int argc, char** argv, std::vector<char*>& envp);