2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #ifndef __DLL_PATH_MANAGER_H__
21 #define __DLL_PATH_MANAGER_H__
24 * This class helps to easily obtain paths that are frequently used in the implementation.
25 * The following paths are the major paths managed by this class.
27 * 1. Platform Assemblies Path
28 * - Paths where the platform assemblies exist
29 * - Installation directory of coreclr and tizenfx are included by default
31 * 2. Application Root Path
32 * - Installation directory of a Tizen application associated with the current process
33 * - bin, lib, data, res directories are under Application Root Path
36 * - The ":" separated paths where applications's managed assemblies exist
37 * - Returns the bin, lib, and .tac_symlink under AppRootPath
38 * - ":" separated path list
41 * - Paths where applications's native image files exist
42 * - Returns bin/.native_image, lib/.native_image, and .tac_symlink under AppRootPath
43 * - ":" separated path list
45 * 5. Native Dll Searching Path
46 * - Path to find native libraries required by coreclr
48 * Platform Assemblies Path can be expanded through the addPlatformAssembliesPath () function.
49 * For example, middleware library path which is passed through plugin can be added to platform assemblies path.
51 * Application related path (AppPath / AppNIPaths / Native Dll Searching Path) is created based on AppRootPath.
52 * Therefore, it has a temporary location before the AppRootPath is set up,
53 * and has the actual location after the setAppRootPath() function is called.
59 * @brief Platform defined path (runtime and tizenfx path) is set by default
60 * Temporal application root path is set by default, and paths which based on application root path is also set.
61 * These paths are updated by calling @setAppRootPath()
71 * @brief Add platform assemblies paths. The TPA(Trusted-Platform-Assembly) is generated based on this paths
72 * @param[in] paths the paths to be added
73 * @param[in] isHighPriority if true, paths are added in front of the current list, otherwise added at the end of the list
75 void addPlatformAssembliesPaths(const std::string& paths, bool isHighPriority = false);
78 * @brief Add native dll searching paths.
79 * @param[in] paths the paths to be added
80 * @param[in] isHighPriority if true, paths are added in front of the current list, otherwise added at the end of the list
82 void addNativeDllSearchingPaths(const std::string& paths, bool isHighPriority = false);
85 * @brief Set application root path.
86 * All application related paths ("bin", "lib", ".tac_symlink", ".native_image") are generated based on it.
87 * A temporary path (/proc/self/fd/[fd]) is used if this function is never called.
88 * @param[in] rootPath application root path
90 void setAppRootPath(const std::string& rootPath);
93 * @brief Get runtime path which contains coreclr and corefx
94 * @return runtime path
96 const std::string& getRuntimePath();
99 * @brief Get tizenfx path which contains tizenfx
100 * @return runtime path
102 const std::string& getTizenFXPath();
105 * @brief Get platform assemblies paths
106 * @return return path vector
108 const std::vector<std::string>& getPlatformAssembliesPaths();
111 * @brief Get application root path
112 * @see setAppRootPath()
113 * @return system paths
115 const std::string& getAppRootPath();
118 * @brief Get the path of .tac_symlink of application
119 * @return .tac_symlink path
121 const std::string& getAppTacPath();
124 * @brief Get the list of directories where the assemlies of this application exist
125 * @return the list(":" seperated) of paths to probe in for an assembly
127 const std::string& getAppPaths();
130 * @brief Get the list of directories where the native image of this application exist
131 * @return the list(":" seperated) of paths to probe in for an native image
133 const std::string& getAppNIPaths();
136 * @brief Set addtional dll searching path for App.
137 * @param[in] paths path
139 void setExtraDllPaths(const char* paths);
142 * @brief Get the list of directories where the native libraries of this application exist
143 * @return the list(":" seperated) of paths the loader should probe when looking for native libraries
145 const std::string& getNativeDllSearchingPaths();
149 * @brief Update application related path (bin, lib, tac_symlink, native_image)
150 * In most cases, appRootPath and appNIRootPath are the same.
151 * Apps installed in read-only storage may have a different appNIRootPath.
152 * @param[in] root path of application. (APP_PATH is geneated based on root path)
153 * @param[in] root path for native image (APP_NI_PATH is generated based on on ni root path )
155 void updateAppRelatedPath(const std::string& appRootPath, const std::string& appNIRootPath);
158 std::vector<std::string> platformAssembliesPaths;
159 std::string systemPaths;
160 std::string appRootPath;
161 std::string appNIRootPath;
162 std::string runtimePath;
163 std::string tizenfxPath;
164 std::string appPaths;
165 std::string appNIPaths;
166 std::string nativeDllSearchingPaths;
167 std::string appTacPath;
168 std::string extraDllPaths;
173 #endif /* __DLL_PATH_MANAGER_H__ */