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[i] paths the paths to be added
73 * @param[i] 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 Set application root path.
79 * All application related paths ("bin", "lib", ".tac_symlink", ".native_image") are generated based on it.
80 * A temporary path (/proc/self/fd/[fd]) is used if this function is never called.
81 * @param[i] rootPath application root path
83 void setAppRootPath(const std::string& rootPath);
86 * @brief Get runtime path which contains coreclr and corefx
87 * @return[i] runtime path
89 const std::string& getRuntimePath();
92 * @brief Get tizenfx path which contains tizenfx
93 * @return[i] runtime path
95 const std::string& getTizenFXPath();
98 * @brief Get platform assemblies paths
99 * @return[i] return path vector
101 const std::vector<std::string>& getPlatformAssembliesPaths();
104 * @brief Get application root path
105 * @see setAppRootPath()
106 * @return[i] system paths
108 const std::string& getAppRootPath();
111 * @brief Get the path of .tac_symlink of application
112 * @return[i] .tac_symlink path
114 const std::string& getAppTacPath();
117 * @brief Get the list of directories where the assemlies of this application exist
118 * @return[i] the list(":" seperated) of paths to probe in for an assembly
120 const std::string& getAppPaths();
123 * @brief Get the list of directories where the native image of this application exist
124 * @return[i] the list(":" seperated) of paths to probe in for an native image
126 const std::string& getAppNIPaths();
129 * @brief Get the list of directories where the native libraries of this application exist
130 * @return[i] the list(":" seperated) of paths the loader should probe when looking for native libraries
132 const std::string& getNativeDllSearchingPaths();
135 // update application related path (bin, lib, tac_symlink, native_image)
136 void updateAppRelatedPath(const std::string& appRootPath);
139 std::vector<std::string> platformAssembliesPaths;
140 std::string systemPaths;
141 std::string appRootPath;
142 std::string runtimePath;
143 std::string tizenfxPath;
144 std::string appPaths;
145 std::string appNIPaths;
146 std::string nativeDllSearchingPaths;
147 std::string appTacPath;
151 #endif /* __DLL_PATH_MANAGER_H__ */