#include "base/logging.h"
#include "atom/common/node_includes.h"
+#include "tizen/common/application_data.h"
+#include "tizen/common/command_line.h"
namespace atom {
return "message from C++";
}
+std::string PWRT::GetPath() {
+ LOG(INFO) << "PWRT::GetPath";
+ common::CommandLine* runtime_cmd = common::CommandLine::ForCurrentProcess();
+ std::string appid = runtime_cmd->GetAppIdFromCommandLine("/usr/bin/electron");
+ auto appdata_manager = common::ApplicationDataManager::GetInstance();
+ common::ApplicationData* app_data = appdata_manager->GetApplicationData(appid);
+ std::string app_path = "file://" + app_data->application_path() + "index.html";
+ return app_path;
+}
+
// static
mate::Handle<PWRT> PWRT::Create(v8::Isolate* isolate) {
LOG(INFO) << "PWRT::Create";
prototype->SetClassName(mate::StringToV8(isolate, "PWRT"));
// TODO: Needs adding necessary interface methods
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
- .SetMethod("getMessage", &PWRT::GetMessage);
+ .SetMethod("getMessage", &PWRT::GetMessage)
+ .SetMethod("getPath", &PWRT::GetPath);
}
} // namespace api