return false;
}
if (!RegisterSecurityContext(ui->appid, pkg_id,
- path/ui->appid, manifest)) {
+ path, manifest)) {
return false;
}
}
return false;
}
if (!RegisterSecurityContext(svc->appid, pkg_id,
- path/svc->appid, manifest)) {
+ path, manifest)) {
return false;
}
}
bf::path install_path = context_->pkg_path.get();
- // FIXME: correctly order app's data.
- // If there is 1 app in package, the app's data are stored in
- // <pkg_path>/<app_id>/
- // If there are >1 apps in the package, app's data are stored in <pkg_path>
- // considering that multiple apps data are already separated in folders.
- manifest_x *m = context_->manifest_data.get();
- if ((m->uiapplication && !m->uiapplication->next && !m->serviceapplication) ||
- (m->serviceapplication && !m->serviceapplication->next &&
- !m->uiapplication)) {
- install_path /= bf::path(context_->manifest_data.get()->mainapp_id);
- }
-
bs::error_code error;
bf::create_directories(install_path.parent_path(), error);
if (error) {
install_path_ = context_->pkg_path.get();
- // FIXME: correctly order app's data.
- // If there is 1 app in package, app's data are stored in <pkg_path>/<app_id>
- // If there are >1 apps in package, app's data are stored in <pkg_path>
- // considering that multiple apps data are already separated in folders.
- manifest_x *m = context_->manifest_data.get();
- if ((m->uiapplication && !m->uiapplication->next && !m->serviceapplication) ||
- (m->serviceapplication && !m->serviceapplication->next &&
- !m->uiapplication))
- install_path_ /= bf::path(context_->manifest_data.get()->mainapp_id);
-
backup_path_ = GetBackupPathForPackagePath(context_->pkg_path.get());
// backup old content
xmlTextWriterWriteAttribute(writer, BAD_CAST "appid", BAD_CAST app->appid);
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
- fs::path exec_path = context_->pkg_path.get() / fs::path(app->appid)
+ fs::path exec_path = context_->pkg_path.get()
/ fs::path("bin") / fs::path(app->appid);
xmlTextWriterWriteAttribute(writer, BAD_CAST "exec",
BAD_CAST exec_path.string().c_str());
try {
// Find (ui|service)-application element, and get appid
if (boost::regex_search(line, m, appid_pattern)) {
- std::string appid = m[3].str();
- pkg_path /= bf::path(appid);
pkg_path /= bf::path("bin");
result = boost::regex_replace(line, appid_exec_replace_pattern,
boost::system::error_code boost_error;
for (; app != nullptr; app=app->next) {
- fs::path bindir = context->pkg_path.get() / fs::path(app->appid) /
+ fs::path bindir = context->pkg_path.get() /
fs::path("bin");
LOG(INFO) << "Creating dir: " << bindir;
if (!common_installer::CreateDir(bindir)) {
if (app->icon && app->icon->name) {
// Check if the icon file actually exists
fs::path src_icon_path = fs::path(context->pkg_path.get())
- / fs::path(app->appid)
/ fs::path(app->icon->name);
if (fs::exists(src_icon_path)) {
// copy icon to the destination dir
* So we don't remove the bin/ directory.
*/
for (; app != nullptr; app=app->next) {
- fs::path exec_path = fs::path(context->pkg_path.get()) /
- fs::path(app->appid) / fs::path("bin");
+ fs::path exec_path = fs::path(context->pkg_path.get()) / fs::path("bin");
fs::remove_all(exec_path / fs::path(app->appid));
}
return true;
step/step_parse.cc
step/step_rds_parse.cc
step/step_rds_modify.cc
+ step/step_wgt_resource_directory.cc
wgt_app_query_interface.cc
wgt_backend.cc
)
for (; ui != nullptr; ui = ui->next) {
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
fs::path exec_path =
- context_->pkg_path.get() / fs::path(ui->appid)
+ context_->pkg_path.get()
/ fs::path("bin");
common_installer::CreateDir(exec_path);
}
for (; svc != nullptr; svc = svc->next) {
// binary is a symbolic link named <appid> and is located in <pkgid>/<appid>
- fs::path exec_path =
- context_->pkg_path.get() / fs::path(svc->appid)/
- fs::path("bin");
+ fs::path exec_path = context_->pkg_path.get() / fs::path("bin");
common_installer::CreateDir(exec_path);
exec_path /= fs::path(svc->appid);
serviceapplication_x* svc = context_->manifest_data.get()->serviceapplication;
for (; ui != nullptr; ui = ui->next) {
- fs::path exec_path =
- context_->pkg_path.get() / fs::path(ui->appid)
- / fs::path("bin");
+ fs::path exec_path = context_->pkg_path.get() / fs::path("bin");
if (fs::exists(exec_path))
fs::remove_all(exec_path);
}
for (; svc != nullptr; svc = svc->next) {
- fs::path exec_path =
- context_->pkg_path.get() / fs::path(svc->appid)
- / fs::path("bin");
+ fs::path exec_path = context_->pkg_path.get() / fs::path("bin");
if (fs::exists(exec_path))
fs::remove_all(exec_path);
}
}
context_->pkg_path.set(
context_->root_application_path.get() /context_->pkgid.get());
- bf::path install_path = context_->pkg_path.get() /
- context_->manifest_data.get()->mainapp_id;
+ bf::path install_path = context_->pkg_path.get() / "res" / "wgt";
bf::path unzip_path = context_->unpacked_dir_path.get();
if (!AddFiles(unzip_path, install_path) ||
!ModifyFiles(unzip_path, install_path) ||
--- /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 "wgt/step/step_wgt_resource_directory.h"
+
+#include <boost/filesystem/path.hpp>
+
+#include "common/utils/file_util.h"
+#include "common/utils/logging.h"
+
+namespace bf = boost::filesystem;
+namespace bs = boost::system;
+
+namespace wgt {
+namespace wgt_resources {
+
+common_installer::Step::Status StepWgtResourceDirectory::process() {
+ bf::path temp_path = context_->unpacked_dir_path.get();
+ temp_path += ".temp";
+ bf::path resource_path = context_->unpacked_dir_path.get() / "res/wgt";
+
+ if (!common_installer::MoveDir(context_->unpacked_dir_path.get(),
+ temp_path)) {
+ LOG(ERROR) << "Failed to move: " << context_->unpacked_dir_path.get()
+ << " to: " << temp_path;
+ return Status::ERROR;
+ }
+ bs::error_code error;
+ bf::create_directories(resource_path.parent_path(), error);
+ if (error) {
+ LOG(ERROR) << "Failed to create proper directory structure in widget";
+ return Status::ERROR;
+ }
+ if (!common_installer::MoveDir(temp_path, resource_path)) {
+ LOG(ERROR) << "Failed to move: " << temp_path << " to: " << resource_path;
+ return Status::ERROR;
+ }
+
+ LOG(INFO) << "Widget content moved to res/wgt subdirectory";
+ return Status::OK;
+}
+
+} // namespace wgt_resources
+} // namespace wgt
--- /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 WGT_STEP_STEP_WGT_RESOURCE_DIRECTORY_H_
+#define WGT_STEP_STEP_WGT_RESOURCE_DIRECTORY_H_
+
+#include "common/app_installer.h"
+#include "common/context_installer.h"
+#include "common/step/step.h"
+#include "common/utils/logging.h"
+
+namespace wgt {
+namespace wgt_resources {
+
+//
+// This step fixes unpacked directory structure so that all widget content
+// is moved from root path to res/wgt before we copy whole directory in
+// StepCopy
+//
+class StepWgtResourceDirectory : public common_installer::Step {
+ public:
+ using Step::Step;
+
+ Status process() override;
+ Status clean() override { return Status::OK; }
+ Status undo() override { return Status::OK; }
+ Status precheck() override { return Status::OK; }
+
+ SCOPE_LOG_TAG(CreateWgtResourceDirectory)
+};
+
+} // namespace wgt_resources
+} // namespace wgt
+
+#endif // WGT_STEP_STEP_WGT_RESOURCE_DIRECTORY_H_
#include "wgt/step/step_parse.h"
#include "wgt/step/step_rds_parse.h"
#include "wgt/step/step_rds_modify.h"
+#include "wgt/step/step_wgt_resource_directory.h"
#include "wgt/wgt_app_query_interface.h"
namespace ci = common_installer;
installer.AddStep<wgt::parse::StepParse>();
installer.AddStep<ci::signature::StepCheckSignature>();
installer.AddStep<wgt::check_settings::StepCheckSettingsLevel>();
+ installer.AddStep<wgt::wgt_resources::StepWgtResourceDirectory>();
installer.AddStep<ci::copy::StepCopy>();
installer.AddStep<ci::create_storage::StepCreateStorageDirectories>();
installer.AddStep<wgt::symbolic_link::StepCreateSymbolicLink>();
installer.AddStep<ci::signature::StepCheckSignature>();
installer.AddStep<wgt::check_settings::StepCheckSettingsLevel>();
installer.AddStep<ci::old_certificate::StepCheckOldCertificate>();
+ installer.AddStep<wgt::wgt_resources::StepWgtResourceDirectory>();
installer.AddStep<ci::old_manifest::StepOldManifest>();
installer.AddStep<ci::backup_manifest::StepBackupManifest>();
installer.AddStep<ci::backup_icons::StepBackupIcons>();