b2427ecfe0d923c5e629d264aeac367d6e61139c
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / asset-manager / asset-manager.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
18 // CLASS HEADER
19 #include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/devel-api/adaptor-framework/environment-variable.h>
23
24 namespace
25 {
26
27 #define TOKEN_STRING(x) #x
28
29 } // unnamed namespace
30
31 namespace Dali
32 {
33
34 namespace Toolkit
35 {
36
37 const std::string AssetManager::GetDaliImagePath()
38 {
39   /**
40    * @note DALI_IMAGE_DIR is a macro that can be defined either with a file system path or zero.
41    *       If it's defined as zero then the value is retrieved from an environment variable
42    *       named DALI_IMAGE_DIR.
43    */
44   return (nullptr == DALI_IMAGE_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_IMAGE_DIR)) : DALI_IMAGE_DIR;
45 }
46
47 const std::string AssetManager::GetDaliSoundPath()
48 {
49   /**
50    * @note DALI_SOUND_DIR is a macro that can be defined either with a file system path or zero.
51    *       If it's defined as zero then the value is retrieved from an environment variable
52    *       named DALI_SOUND_DIR.
53    */
54   return (nullptr == DALI_SOUND_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_SOUND_DIR)) : DALI_SOUND_DIR;
55 }
56
57 const std::string AssetManager::GetDaliStylePath()
58 {
59   /**
60    * @note DALI_STYLE_DIR is a macro that can be defined either with a file system path or zero.
61    *       If it's defined as zero then the value is retrieved from an environment variable
62    *       named DALI_STYLE_DIR.
63    */
64   return (nullptr == DALI_STYLE_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_STYLE_DIR)) : DALI_STYLE_DIR;
65 }
66
67 const std::string AssetManager::GetDaliStyleImagePath()
68 {
69   /**
70    * @note DALI_STYLE_IMAGE_DIR is a macro that can be defined either with a file system path or zero.
71    *       If it's defined as zero then the value is retrieved from an environment variable
72    *       named DALI_STYLE_IMAGE_DIR.
73    */
74   return (nullptr == DALI_STYLE_IMAGE_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_STYLE_IMAGE_DIR)) : DALI_STYLE_IMAGE_DIR;
75 }
76
77 const std::string AssetManager::GetDaliDataReadOnlyPath()
78 {
79   /**
80    * @note DALI_DATA_READ_ONLY_DIR is a macro that can be defined either with a file system path or zero.
81    *       If it's defined as zero then the value is retrieved from an environment variable
82    *       named DALI_DATA_READ_ONLY_DIR.
83    */
84   return (nullptr == DALI_DATA_READ_ONLY_DIR) ? EnvironmentVariable::GetEnvironmentVariable(TOKEN_STRING(DALI_DATA_READ_ONLY_DIR)) : DALI_DATA_READ_ONLY_DIR;
85 }
86
87 } // Toolkit
88
89 } // Dali