From f2251075085e340a5b4db51aa744cbbea25058d4 Mon Sep 17 00:00:00 2001 From: Tomasz Iwanek Date: Mon, 23 Feb 2015 11:35:33 +0100 Subject: [PATCH] Move file_util.cc to utils Change-Id: Ida4e0c8c922549165f318b7ca3292d1a4fd381ba --- src/common/CMakeLists.txt | 1 - src/common/step/step_copy.cc | 2 +- src/common/step/step_generate_xml.cc | 2 +- src/common/step/step_parse.cc | 2 +- src/common/step/step_record.cc | 2 +- src/common/step/step_remove.cc | 2 +- src/common/step/step_signal.cc | 2 +- src/common/step/step_unregister.cc | 2 +- src/common/step/step_unzip.cc | 2 +- src/utils/CMakeLists.txt | 1 + src/{common/utils.cc => utils/file_util.cc} | 4 +++- src/{common/utils.h => utils/file_util.h} | 8 +++++--- src/wgt/step/step_symbolic_link.cc | 6 +++--- 13 files changed, 20 insertions(+), 16 deletions(-) rename src/{common/utils.cc => utils/file_util.cc} (95%) rename src/{common/utils.h => utils/file_util.h} (68%) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 8b2ef6b..0e29938 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -15,7 +15,6 @@ SET(SRCS step/step_security.cc step/step_signal.cc step/step_unregister.cc - utils.cc ) # Target - definition ADD_LIBRARY(${TARGET_LIBNAME_COMMON} SHARED ${SRCS}) diff --git a/src/common/step/step_copy.cc b/src/common/step/step_copy.cc index b8e0332..b29bf40 100644 --- a/src/common/step/step_copy.cc +++ b/src/common/step/step_copy.cc @@ -6,7 +6,7 @@ #include #include -#include "common/utils.h" +#include "utils/file_util.h" namespace common_installer { namespace copy { diff --git a/src/common/step/step_generate_xml.cc b/src/common/step/step_generate_xml.cc index 2d5feb7..03b2b98 100644 --- a/src/common/step/step_generate_xml.cc +++ b/src/common/step/step_generate_xml.cc @@ -14,7 +14,7 @@ #include #include -#include "common/utils.h" +#include "utils/file_util.h" #define PKGMGR_LIST_MOVE_NODE_TO_HEAD(list, node) do { \ if (list) { LISTHEAD(list, node); } \ diff --git a/src/common/step/step_parse.cc b/src/common/step/step_parse.cc index 7c7471d..56d8657 100644 --- a/src/common/step/step_parse.cc +++ b/src/common/step/step_parse.cc @@ -11,7 +11,7 @@ #include #include -#include "common/utils.h" +#include "utils/file_util.h" namespace common_installer { namespace parse { diff --git a/src/common/step/step_record.cc b/src/common/step/step_record.cc index c65edbc..cd581a7 100644 --- a/src/common/step/step_record.cc +++ b/src/common/step/step_record.cc @@ -11,7 +11,7 @@ #include #include -#include "common/utils.h" +#include "utils/file_util.h" namespace { diff --git a/src/common/step/step_remove.cc b/src/common/step/step_remove.cc index c588e2c..e3761ab 100755 --- a/src/common/step/step_remove.cc +++ b/src/common/step/step_remove.cc @@ -9,7 +9,7 @@ #include -#include "common/utils.h" +#include "utils/file_util.h" namespace common_installer { namespace remove { diff --git a/src/common/step/step_signal.cc b/src/common/step/step_signal.cc index 25f6002..c595d87 100644 --- a/src/common/step/step_signal.cc +++ b/src/common/step/step_signal.cc @@ -5,7 +5,7 @@ #include #include -#include "common/utils.h" +#include "utils/file_util.h" namespace common_installer { namespace signal { diff --git a/src/common/step/step_unregister.cc b/src/common/step/step_unregister.cc index 21a584a..ca8c10e 100755 --- a/src/common/step/step_unregister.cc +++ b/src/common/step/step_unregister.cc @@ -9,7 +9,7 @@ #include #include "common/step/step_unregister.h" -#include "common/utils.h" +#include "utils/file_util.h" namespace common_installer { namespace unregister { diff --git a/src/common/step/step_unzip.cc b/src/common/step/step_unzip.cc index 0c47ba9..e775b51 100644 --- a/src/common/step/step_unzip.cc +++ b/src/common/step/step_unzip.cc @@ -17,7 +17,7 @@ #include #include -#include "common/utils.h" +#include "utils/file_util.h" #define ZIPBUFSIZE 8192 #define ZIPMAXPATH 256 diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 3b985a8..463030c 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -1,5 +1,6 @@ # Target - sources SET(SRCS + file_util.cc system_locale.cc string_util.cc values.cc diff --git a/src/common/utils.cc b/src/utils/file_util.cc similarity index 95% rename from src/common/utils.cc rename to src/utils/file_util.cc index 5130417..5357223 100644 --- a/src/common/utils.cc +++ b/src/utils/file_util.cc @@ -1,12 +1,13 @@ /* 2014, Copyright © Intel Coporation, license APACHE-2.0, see LICENSE file */ -#include "common/utils.h" +#include "utils/file_util.h" #include #include #include "utils/logging.h" +namespace common_installer { namespace utils { namespace fs = boost::filesystem; @@ -79,3 +80,4 @@ bool CopyDir(const fs::path& src, const fs::path& dst) { } } // namespace utils +} // namespace common_installer diff --git a/src/common/utils.h b/src/utils/file_util.h similarity index 68% rename from src/common/utils.h rename to src/utils/file_util.h index f2030b6..c46b64f 100644 --- a/src/common/utils.h +++ b/src/utils/file_util.h @@ -1,10 +1,11 @@ /* 2014, Copyright © Intel Coporation, license APACHE-2.0, see LICENSE file */ -#ifndef COMMON_UTILS_H_ -#define COMMON_UTILS_H_ +#ifndef UTILS_FILE_UTIL_H_ +#define UTILS_FILE_UTIL_H_ #include +namespace common_installer { namespace utils { bool CreateDir(const boost::filesystem::path& path); @@ -13,5 +14,6 @@ bool CopyDir(const boost::filesystem::path& src, const boost::filesystem::path& dst); } // namespace utils +} // namespace common_installer -#endif // COMMON_UTILS_H_ +#endif // UTILS_FILE_UTIL_H_ diff --git a/src/wgt/step/step_symbolic_link.cc b/src/wgt/step/step_symbolic_link.cc index af5bb26..58a50ed 100644 --- a/src/wgt/step/step_symbolic_link.cc +++ b/src/wgt/step/step_symbolic_link.cc @@ -11,7 +11,7 @@ #include #include -#include "common/utils.h" +#include "utils/file_util.h" namespace wgt { namespace symbolic_link { @@ -33,7 +33,7 @@ common_installer::Step::Status StepSymbolicLink::process() { // binary is a symbolic link named and is located in / fs::path exec_path = fs::path(context_->pkg_path()) / fs::path(ui->appid) / fs::path("bin"); - utils::CreateDir(exec_path); + common_installer::utils::CreateDir(exec_path); exec_path /= fs::path(ui->appid); @@ -48,7 +48,7 @@ common_installer::Step::Status StepSymbolicLink::process() { // binary is a symbolic link named and is located in / fs::path exec_path = fs::path(context_->pkg_path()) / fs::path(svc->appid) / fs::path("bin"); - utils::CreateDir(exec_path); + common_installer::utils::CreateDir(exec_path); exec_path /= fs::path(svc->appid); -- 2.7.4