Bug-fix: fix target dll searching logic
[platform/core/dotnet/launcher.git] / NativeLauncher / inc / path_manager.h
index 264d4b6..b3bc88e 100644 (file)
@@ -52,7 +52,7 @@
  * Therefore, it has a temporary location before the AppRootPath is set up,
  * and has the actual location after the setAppRootPath() function is called.
 */
-class PathManager 
+class PathManager
 {
 public:
        /**
@@ -69,83 +69,105 @@ public:
 
        /**
         * @brief Add platform assemblies paths. The TPA(Trusted-Platform-Assembly) is generated based on this paths
-        * @param[i] paths the paths to be added
-        * @param[i] isHighPriority if true, paths are added in front of the current list, otherwise added at the end of the list
+        * @param[in] paths the paths to be added
+        * @param[in] isHighPriority if true, paths are added in front of the current list, otherwise added at the end of the list
         */
        void addPlatformAssembliesPaths(const std::string& paths, bool isHighPriority = false);
 
        /**
+        * @brief Add native dll searching paths.
+        * @param[in] paths the paths to be added
+        * @param[in] isHighPriority if true, paths are added in front of the current list, otherwise added at the end of the list
+        */
+       void addNativeDllSearchingPaths(const std::string& paths, bool isHighPriority = false);
+
+       /**
         * @brief Set application root path.
         *        All application related paths ("bin", "lib", ".tac_symlink", ".native_image") are generated based on it.
         *        A temporary path (/proc/self/fd/[fd]) is used if this function is never called.
-        * @param[i] rootPath application root path
+        * @param[in] rootPath application root path
         */
        void setAppRootPath(const std::string& rootPath);
 
        /**
         * @brief Get runtime path which contains coreclr and corefx
-        * @return[i] runtime path
+        * @return runtime path
         */
        const std::string& getRuntimePath();
 
        /**
         * @brief Get tizenfx path which contains tizenfx
-        * @return[i] runtime path
+        * @return runtime path
         */
        const std::string& getTizenFXPath();
 
        /**
         * @brief Get platform assemblies paths
-        * @return[i] return path vector
+        * @return return path vector
         */
        const std::vector<std::string>& getPlatformAssembliesPaths();
 
        /**
         * @brief Get application root path
         * @see setAppRootPath()
-        * @return[i] system paths
+        * @return system paths
         */
        const std::string& getAppRootPath();
 
        /**
         * @brief Get the path of .tac_symlink of application
-        * @return[i] .tac_symlink path
+        * @return .tac_symlink path
         */
        const std::string& getAppTacPath();
 
        /**
         * @brief Get the list of directories where the assemlies of this application exist
-        * @return[i] the list(":" seperated) of paths to probe in for an assembly
+        * @return the list(":" seperated) of paths to probe in for an assembly
         */
        const std::string& getAppPaths();
 
        /**
         * @brief Get the list of directories where the native image of this application exist
-        * @return[i] the list(":" seperated) of paths to probe in for an native image
+        * @return the list(":" seperated) of paths to probe in for an native image
         */
        const std::string& getAppNIPaths();
 
        /**
+        * @brief Set addtional dll searching path for App.
+        * @param[in] paths path
+        */
+       void setExtraDllPaths(const char* paths);
+
+       /**
         * @brief Get the list of directories where the native libraries of this application exist
-        * @return[i] the list(":" seperated) of paths the loader should probe when looking for native libraries
+        * @return the list(":" seperated) of paths the loader should probe when looking for native libraries
         */
        const std::string& getNativeDllSearchingPaths();
 
 private:
-       // update application related path (bin, lib, tac_symlink, native_image)
-       void updateAppRelatedPath(const std::string& appRootPath);
+       /**
+        * @brief Update application related path (bin, lib, tac_symlink, native_image)
+        *        In most cases, appRootPath and appNIRootPath are the same.
+        *        Apps installed in read-only storage may have a different appNIRootPath.
+        * @param[in] root path of application. (APP_PATH is geneated based on root path)
+        * @param[in] root path for native image (APP_NI_PATH is generated based on on ni root path )
+        */
+       void updateAppRelatedPath(const std::string& appRootPath, const std::string& appNIRootPath);
 
 private:
        std::vector<std::string> platformAssembliesPaths;
        std::string systemPaths;
        std::string appRootPath;
+       std::string appNIRootPath;
        std::string runtimePath;
        std::string tizenfxPath;
        std::string appPaths;
        std::string appNIPaths;
        std::string nativeDllSearchingPaths;
        std::string appTacPath;
+       std::string extraDllPaths;
        int rootFD;
+       int niRootFD;
 };
 
 #endif /* __DLL_PATH_MANAGER_H__ */