step/step_parse.cc
step/step_remove_icons.cc
step/step_remove_files.cc
+ step/step_remove_temporary_directory.cc
step/step_revoke_security.cc
step/step_register_security.cc
step/step_unregister_app.cc
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+#include "common/step/step_remove_temporary_directory.h"
+
+#include <boost/filesystem.hpp>
+#include <boost/system/error_code.hpp>
+
+#include "common/context_installer.h"
+
+namespace common_installer {
+namespace filesystem {
+
+namespace bf = boost::filesystem;
+
+Step::Status StepRemoveTemporaryDirectory::RecoveryUpdate() {
+ RemoveFiles();
+ return Step::Status::OK;
+}
+
+Step::Status StepRemoveTemporaryDirectory::RecoveryNew() {
+ RemoveFiles();
+ return Step::Status::OK;
+}
+
+void StepRemoveTemporaryDirectory::RemoveFiles() {
+ bf::path unpack_dir_path = context_->unpacked_dir_path.get();
+ if (unpack_dir_path.empty())
+ return;
+ boost::system::error_code error_code;
+ bf::remove_all(unpack_dir_path, error_code);
+ return;
+}
+} // namespace filesystem
+} // namespace common_installer
+
--- /dev/null
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef COMMON_STEP_STEP_REMOVE_TEMPORARY_DIRECTORY_H_
+#define COMMON_STEP_STEP_REMOVE_TEMPORARY_DIRECTORY_H_
+
+#include "common/step/step_recovery.h"
+
+namespace common_installer {
+namespace filesystem {
+
+/**
+ * @brief removes temp directories if install gets
+ * interrupted
+ *
+ * Part of Recovery Mode. If recovery mode gets called
+ * path to temporary unpack directory and its content get
+ * deleted
+ */
+class StepRemoveTemporaryDirectory : public recovery::StepRecovery {
+ public:
+ using StepRecovery::StepRecovery;
+
+ Status RecoveryNew() override;
+ Status RecoveryUpdate() override;
+ private:
+ /**
+ * @brief RemoveFiles
+ * Removes all the temporary files
+ */
+ void RemoveFiles();
+
+ SCOPE_LOG_TAG(RemoveTemporaryDirectory)
+};
+
+} // namespace filesystem
+} // namespace common_installer
+
+#endif // COMMON_STEP_STEP_REMOVE_TEMPORARY_DIRECTORY_H_