Merge "remove test2 text" into tizen
[scm/test.git] / src / utils.c
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 #include "app-log.h"
18 #include "utils.h"
19 #include "analog-watch.h"
20
21 /*
22  * @brief Creates path to the given resource file by concatenation of the basic resource path and the given file_name.
23  * @param[in] file_name File name or path relative to the resource directory.
24  * @return: The absolute path to the resource with given file_name is returned.
25  */
26 char *utils_create_resource_path(const char *file_name)
27 {
28         static char res_path_buff[PATH_MAX] = {0,};
29         char *res_path = NULL;
30
31         res_path = app_get_resource_path();
32         if (res_path == NULL) {
33                 __E("failed to get resource path.");
34                 return NULL;
35         }
36
37         snprintf(res_path_buff, PATH_MAX, "%s%s", res_path, file_name);
38         free(res_path);
39
40         return &res_path_buff[0];
41 }
42
43
44