To avoid throwing the exception, this patch uses the following method:
- bool create_directory( const std::filesystem::path& p,
std::error_code& ec ) noexcept;
Change-Id: I2df244b430181c7c9736c87f7a4ab999ecf47d03
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
try {
std::string path = "/run/aul/apps/" + std::to_string(getuid()) + "/" +
std::to_string(getpid());
- if (access(path.c_str(), F_OK) != 0)
- fs::create_directory(path);
+ if (access(path.c_str(), F_OK) != 0) {
+ std::error_code ec;
+ if (!fs::create_directory(path, ec)) {
+ _E("Failed to create directory. path=%s, error_code=%d(%s)",
+ path.c_str(), ec.value(), ec.message().c_str());
+ return -1;
+ }
+ }
path += "/.app-sock";
ServerSocket socket;