std::filesystem::exists() can throw exception.
To prevent this, we change that method to access().
Change-Id: Iaa2b90adb2fc62cf95d82d342f1f772b17de1c8d
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
std::string path = "/tmp/." + std::to_string(getuid()) + "-" +
GetLoaderName() + ".ready";
std::filesystem::path file_path(path);
- if (std::filesystem::exists(file_path)) {
+ if (access(file_path.c_str(), F_OK) == 0) {
ready_file_created_ = true;
return;
}
}
int CreateDirectory(const std::string &path) {
- if (std::filesystem::exists(path))
+ if (access(path.c_str(), F_OK) == 0)
return 0;
try {
}
std::filesystem::path smaps_path = "/proc/" + std::to_string(pid) + "/smaps";
- if (!std::filesystem::exists(smaps_path)) {
+ if (access(smaps_path.c_str(), F_OK) != 0) {
_E("%s does not exist", smaps_path.c_str());
return;
}
std::string Util::GetLibDirectory(const std::string& app_path) {
std::filesystem::path path(app_path);
auto lib_dir = path.parent_path().string() + "/../lib/";
- if (std::filesystem::exists(lib_dir))
+ if (access(lib_dir.c_str(), F_OK) == 0)
return lib_dir;
return "";