1 #include "dotnet/dotnet_launcher.h"
2 #include "mono/mono_launcher.h"
13 static std::string StandaloneOption("--standalone");
15 int main(int argc, char *argv[])
18 bool standalone = false;
19 const char* standalonePath = nullptr;
21 std::vector<char*> vargs;
23 for (i=1; i<argc; i++)
25 if (StandaloneOption.compare(argv[i]) == 0)
31 fprintf(stderr, "Assembly path must be after \"--standalone\" option\n");
35 standalonePath = argv[i];
39 vargs.push_back(argv[i]);
43 using tizen::runtime::LauncherInterface;
44 using tizen::runtime::Launchpad;
45 using tizen::runtime::AppInfo;
46 std::unique_ptr<LauncherInterface> runtime;
48 bool useMono = !FileNotExist("/etc/.use_mono");
52 using tizen::runtime::dotnetcore::CoreRuntime;
53 std::unique_ptr<LauncherInterface> coreRuntime(new CoreRuntime());
54 runtime = std::move(coreRuntime);
58 using tizen::runtime::mono::MonoRuntime;
59 std::unique_ptr<LauncherInterface> monoRuntime(new MonoRuntime());
60 runtime = std::move(monoRuntime);
65 std::string base = Basename(standalonePath);
66 if (runtime->Initialize(true) != 0)
68 _ERR("Failed to initialize");
71 if (runtime->RunManagedLauncher() != 0)
73 _ERR("Failed to run managed launcher");
77 int args_len = vargs.size();
78 char** args = &vargs[0];
79 if (!runtime->Launch(base.c_str(), standalonePath, args_len, args))
81 _ERR("Failed to launch");
87 Launchpad.OnCreate = [&runtime]
89 auto idle_task = [](void *data) -> Eina_Bool
91 LauncherInterface* runtime = static_cast<LauncherInterface*>(data);
92 if (runtime->RunManagedLauncher() != 0)
94 _ERR("Failed to run managed launcher");
96 return ECORE_CALLBACK_CANCEL;
98 if (runtime->Initialize(false) != 0)
100 _ERR("Failed to initialized");
103 ecore_idler_add(idle_task, runtime.get());
106 Launchpad.OnTerminate = [&runtime](const AppInfo& info, int argc, char** argv)
108 _DBG("terminated with app path : %s", info.path.c_str());
109 _DBG("appid : %s", info.id.c_str());
110 _DBG("pkg : %s", info.pkg.c_str());
111 _DBG("type : %s", info.type.c_str());
113 if (!runtime->Launch(info.root.c_str(), info.path.c_str(), argc, argv))
115 _ERR("Failed to launch");
118 Launchpad.LoaderMain(argc, argv);