Change the logic to check the native image with ildasm
authorj-h.choi <j-h.choi@samsung.com>
Thu, 5 Nov 2020 06:45:07 +0000 (15:45 +0900)
committer조웅석/Common Platform Lab(SR)/Principal Engineer/삼성전자 <ws77.cho@samsung.com>
Fri, 18 Dec 2020 00:55:28 +0000 (09:55 +0900)
Change-Id: Ie6bfcf378ea4bd3edd4708ea7f6bfd2fd5d8a104

NativeLauncher/tool/ni_common.cc

index 1cd885f..db1eab6 100644 (file)
@@ -422,20 +422,15 @@ static bool isCoreLibPrepared(DWORD flags)
 
 static bool hasCoreLibNI()
 {
-       FILE *fp;
-       char buff[1024];
        std::string ildasm = concatPath(__pm->getRuntimePath(), "ildasm");
        std::string coreLib = concatPath(__pm->getRuntimePath(), "System.Private.CoreLib.dll");
-       std::string cmd = ildasm + " " + coreLib + " | grep '\\.corflags'";
+       std::string cmd = ildasm + " " + coreLib + " -noil -stats | grep '\\.xdata'";
+
+       FILE *fp;
        fp = popen(cmd.c_str(), "r");
        if (fp != NULL) {
-               while (fgets(buff, sizeof(buff), fp) != NULL) {
-                       buff[strlen(buff) - 1] = '\0';
-               }
-               std::string corflag = replaceAll(buff, ".corflags", "");
-               corflag.erase(std::remove(corflag.begin(), corflag.end(), ' '), corflag.end());
-               // CorFlags.ILLibrary=0x00000004 (.ni.dll)
-               if (!strcmp(corflag.substr(0, 10).c_str(), "0x00000004")) {
+               char buff[1024];
+               if (fgets(buff, sizeof(buff), fp) != NULL) {
                        pclose(fp);
                        return true;
                }