Fix App Root on standalone and support direct exec
authorpius.lee <pius.lee@samsung.com>
Mon, 17 Oct 2016 09:52:23 +0000 (18:52 +0900)
committerpius.lee <pius.lee@samsung.com>
Mon, 17 Oct 2016 10:02:03 +0000 (19:02 +0900)
Set application root with aul_get_app_root_path() if AUL_APPID is exist.
Add dotnet.launcher direct execute in launchpad.

Change-Id: I4e45731c791449e3afa4e698b8bbb8ea3bede91f

NativeLauncher/CMakeLists.txt
NativeLauncher/dotnet.launcher [new file with mode: 0644]
NativeLauncher/src/main.cc
packaging/dotnet-launcher.spec

index 37db3f2..9cd33a3 100644 (file)
@@ -77,4 +77,5 @@ SET_TARGET_PROPERTIES(${DOTNET_LAUNCHER}
 IF(NOT DEFINED NO_TIZEN)
        INSTALL(TARGETS ${DOTNET_LAUNCHER} DESTINATION ${BINDIR})
        INSTALL(FILES dotnet.loader DESTINATION ${LOADERDIR})
+       INSTALL(FILES dotnet.launcher DESTINATION ${LOADERDIR})
 ENDIF(NOT DEFINED NO_TIZEN)
diff --git a/NativeLauncher/dotnet.launcher b/NativeLauncher/dotnet.launcher
new file mode 100644 (file)
index 0000000..846e372
--- /dev/null
@@ -0,0 +1,6 @@
+[LAUNCHER]
+NAME   dotnet-launcher
+EXE    /usr/bin/dotnet-launcher
+APP_TYPE       dotnet
+EXTRA_ARG      --standalone
+
index c9790ce..248de99 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <Ecore.h>
 #include <Eina.h>
+#include <aul.h>
 
 #define __XSTR(x) #x
 #define __STR(x) __XSTR(x)
@@ -67,17 +68,32 @@ int main(int argc, char *argv[])
     using tizen::runtime::dotnetcore::CoreRuntime;
     std::unique_ptr<LauncherInterface> coreRuntime(new CoreRuntime());
     runtime = std::move(coreRuntime);
+
+    _DBG("##### CoreCLR Launcher ######");
   }
   else
   {
     using tizen::runtime::mono::MonoRuntime;
     std::unique_ptr<LauncherInterface> monoRuntime(new MonoRuntime());
     runtime = std::move(monoRuntime);
+
+    _DBG("##### Mono Launcher ######");
   }
 
   if (standalone)
   {
-    std::string base = Basename(standalonePath);
+    _DBG("##### Run it standalone #########");
+    const char* appid = getenv("AUL_APPID");
+    _DBG("AUL_APPID : %s", appid);
+    std::string approot;
+    if (appid != nullptr)
+    {
+      approot = std::string(aul_get_app_root_path());
+    }
+    else
+    {
+      approot = Basename(standalonePath);
+    }
     if (runtime->Initialize(true) != 0)
     {
       _ERR("Failed to initialize");
@@ -91,10 +107,10 @@ int main(int argc, char *argv[])
 
     int args_len = vargs.size();
     char** args = &vargs[0];
-    if (!runtime->Launch(base.c_str(), standalonePath, args_len, args))
+    if (runtime->Launch(approot.c_str(), standalonePath, args_len, args))
     {
         _ERR("Failed to launch");
-        return 1;
+        return 0;
     }
   }
   else
@@ -125,7 +141,7 @@ int main(int argc, char *argv[])
       _DBG("pkg : %s", info.pkg.c_str());
       _DBG("type : %s", info.type.c_str());
 
-      if (!runtime->Launch(info.root.c_str(), info.path.c_str(), argc, argv))
+      if (runtime->Launch(info.root.c_str(), info.path.c_str(), argc, argv))
       {
         _ERR("Failed to launch");
       }
index 9ff66ee..2891a2b 100644 (file)
@@ -2,7 +2,7 @@
 
 Name:       dotnet-launcher
 Summary:    Launchpad plugin for dotnet apps
-Version:    1.0.0
+Version:    1.0.1
 Release:    2
 Group:      Application Framework/Application State Management
 License:    Apache License, Version 2.0
@@ -84,6 +84,7 @@ install -p -m 644 Tizen.Runtime/bin/Tizen.Runtime.Mono.dll %{buildroot}%{_bindir
 %files
 %manifest dotnet-launcher.manifest
 %{_loaderdir}/dotnet.loader
+%{_loaderdir}/dotnet.launcher
 %caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/dotnet-launcher
 %caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/Tizen.Runtime.Coreclr.dll
 %caps(cap_mac_admin,cap_setgid=ei) %{_bindir}/Tizen.Runtime.Mono.dll