bug-fix : support TAC and NI_SUB_DIR for nitool --pkg-dll option
[platform/core/dotnet/launcher.git] / NativeLauncher / tool / ni_common.cc
index 1743c79..666f752 100644 (file)
@@ -108,15 +108,20 @@ static std::string getNiFilePath(const std::string& dllPath)
 
 static std::string getAppNIPath(const std::string& niPath)
 {
+       std::string fileName;
+       std::string niDirPath;
+       std::string prevPath;
+
        size_t index = niPath.find_last_of("/");
-       if (index == std::string::npos) {
-               fprintf(stderr, "dllPath doesnot contains path info\n");
-               return "";
+       if (index != std::string::npos) {
+               prevPath = niPath.substr(0, index);
+               fileName = niPath.substr(index + 1, niPath.length());
+       } else {
+               prevPath = ".";
+               fileName = niPath;
        }
 
-       std::string prevPath = niPath.substr(0, index);
-       std::string fileName = niPath.substr(index, niPath.length());
-       std::string niDirPath = concatPath(prevPath, APP_NI_SUB_DIR);
+       niDirPath = concatPath(prevPath, APP_NI_SUB_DIR);
 
        if (!isFileExist(niDirPath)) {
                if (mkdir(niDirPath.c_str(), 0755) == 0) {
@@ -126,7 +131,7 @@ static std::string getAppNIPath(const std::string& niPath)
                }
        }
 
-       return niDirPath + fileName;
+       return concatPath(niDirPath, fileName);
 }
 
 static bool niExist(const std::string& path)
@@ -394,7 +399,8 @@ ni_error_e createNiDllUnderPkgRoot(const std::string& pkgId, const std::string&
 
        std::string binDir = concatPath(pkgRoot, "bin");
        std::string libDir = concatPath(pkgRoot, "lib");
-       std::string paths = binDir + ":" + libDir;
+       std::string appTAC = concatPath(binDir, ".TAC.Release");
+       std::string paths = binDir + ":" + libDir + ":" + appTAC;
 
        return crossgen(dllPath, paths, enableR2R, true);
 }