[Refactoring] Improve SAM score through DC and GV improvement
[platform/core/dotnet/launcher.git] / NativeLauncher / hydra / hydra_main.cc
index b0e7671..7ced0a3 100644 (file)
 #include "log.h"
 #include "launcher_env.h"
 
-const char* __coreclr_lib = "/usr/share/dotnet.tizen/netcoreapp/libcoreclr.so";
-const char* __dotnet_loader = "/usr/bin/dotnet-loader";
+static const char* __coreclr_lib = "/usr/share/dotnet.tizen/netcoreapp/libcoreclr.so";
+static const char* __dotnet_loader = "/usr/bin/dotnet-loader";
 
 typedef int (*coreclr_preload_assembly_ptr)(const char* assemblyPath);
-typedef int (*launcher_real_main_ptr)(int argc, char *argv[], const char* mode);
+typedef int (*launcher_real_main_ptr)(int argc, char *argv[]);
 
-static std::string absolutePath(const std::string& path)
+static std::string getAbsolutePath(const std::string& path)
 {
        std::string absPath;
        char *realPath = realpath(path.c_str(), NULL);
@@ -49,10 +49,10 @@ static std::string absolutePath(const std::string& path)
        return absPath;
 }
 
-static bool isFileExist(const std::string& path)
+static bool isFile(const std::string& path)
 {
        struct stat sb;
-       return stat(path.c_str(), &sb) == 0;
+       return lstat(path.c_str(), &sb) == 0;
 }
 
 static std::string replaceAll(const std::string& str, const std::string& pattern, const std::string& replace)
@@ -78,13 +78,13 @@ static std::string findDllPath(const std::string& filename)
 
        // check whether the target file exist under netcoreapp directory
        result = netcoreappDir + filename;
-       if (isFileExist(result)) {
+       if (isFile(result)) {
                return result;
        }
 
        // check whether the target file exist under framework directory
        result = frameworkDir + filename;
-       if (isFileExist(result)) {
+       if (isFile(result)) {
                return result;
        }
 
@@ -168,7 +168,7 @@ static void preloadAssemblies()
                                // check whether the target file exist under netcoreapp directory
                                std::string path = findDllPath(in_line);
                                if (!path.empty()) {
-                                       int st = preloadAssembly(absolutePath(path).c_str());
+                                       int st = preloadAssembly(getAbsolutePath(path).c_str());
                                        if (st != 0) {
                                                _ERR("preload of %s failed! (0x%08x)", path.c_str(), st);
                                        } else {
@@ -212,7 +212,7 @@ int main(int argc, char** argv)
                        return -1;
                }
 
-               return realMain(argc, argv, "default");
+               return realMain(argc, argv);
        };
 
        hydra_callback.terminate = [](void* user_data)-> int {