Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / filesystem / step_create_icons.cc
index 391f20e..86f5293 100644 (file)
@@ -4,15 +4,15 @@
 
 #include "common/step/filesystem/step_create_icons.h"
 
-#include <boost/filesystem/operations.hpp>
-#include <boost/system/error_code.hpp>
 #include <pkgmgr-info.h>
 
+#include <filesystem>
+#include <system_error>
+
 #include "common/utils/file_util.h"
 #include "common/utils/glist_range.h"
 
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+namespace fs = std::filesystem;
 
 namespace common_installer {
 namespace filesystem {
@@ -30,10 +30,10 @@ Step::Status StepCreateIcons::process() {
   if (!extra_icon_path)
     return Status::OK;
 
-  bf::path destination = extra_icon_path;
-  bs::error_code error;
-  if (!bf::exists(destination)) {
-    bf::create_directories(destination, error);
+  fs::path destination = extra_icon_path;
+  std::error_code error;
+  if (!fs::exists(destination)) {
+    fs::create_directories(destination, error);
     if (error) {
       LOG(ERROR) << "Cannot create directory of application icons: "
                  << destination;
@@ -49,17 +49,17 @@ Step::Status StepCreateIcons::process() {
       continue;
 
     icon_x* icon = reinterpret_cast<icon_x*>(app->icon->data);
-    bf::path source(icon->text);
-    if (!bf::exists(source))
+    fs::path source(icon->text);
+    if (!fs::exists(source))
       continue;
 
-    bf::path destination_path = destination / app->appid;
+    fs::path destination_path = destination / app->appid;
     if (source.has_extension())
       destination_path += source.extension();
     else
       destination_path += ".png";
-    bf::copy_file(source, destination_path,
-                  bf::copy_option::overwrite_if_exists, error);
+    fs::copy_file(source, destination_path,
+                  fs::copy_options::overwrite_existing, error);
     if (error) {
       LOG(ERROR) << "Cannot create package icon: " << destination_path
                  << " , error: " << error;