534be8b83b48fa2999abdccce8d373010b0fe199
[platform/core/dotnet/launcher.git] / NativeLauncher / inc / utils.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __UTILS_H__
18 #define __UTILS_H__
19
20 #include <string>
21 #include <vector>
22 #include <functional>
23 #include <map>
24
25 #ifndef PATH_SEPARATOR
26 #define PATH_SEPARATOR '/'
27 #endif
28
29 std::string readSelfPath();
30
31 std::string concatPath(const std::string& path1, const std::string& path2);
32 std::string absolutePath(const std::string& path);
33 std::string baseName(const std::string& path);
34 void splitPath(const std::string& path, std::vector<std::string>& out);
35 void appendPath(std::string& path1, const std::string& path2);
36
37 bool isFileExist(const std::string& path);
38
39 bool isManagedAssembly(const std::string& fileName);
40 bool isNativeImage(const std::string& fileName);
41
42 void assembliesInDirectory(const std::vector<std::string>& directories, std::string& tpaList);
43
44 typedef std::function<void (const std::string&, const char*)> FileReader;
45 void scanFilesInDir(const std::string& directory, FileReader reader, unsigned int depth);
46
47 int runLoggingThread();
48 #endif /* __UTILS_H__ */