Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / windows / system-settings-win.cpp
1 /*
2  * Copyright (c) 2023 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/internal/system/common/system-settings.h>
20
21 // EXTERNAL INCLUDES
22 #include <stdlib.h>
23
24 namespace Dali
25 {
26 namespace Internal
27 {
28 namespace Adaptor
29 {
30 namespace SystemSettings
31 {
32 std::string GetResourcePath()
33 {
34   // "DALI_APPLICATION_PACKAGE" is used by Windows specifically to get the already configured Application package path.
35   const char* winEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
36   char*       value                  = getenv(winEnvironmentVariable);
37   std::string resourcePath;
38   if(value != NULL)
39   {
40     resourcePath = value;
41   }
42
43   if(resourcePath.back() != '/')
44   {
45     resourcePath += "/";
46   }
47
48   return resourcePath;
49 }
50
51 std::string GetDataPath()
52 {
53   const char* winEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
54   char*       value                  = getenv(winEnvironmentVariable);
55   std::string dataPath;
56   if(value != NULL)
57   {
58     dataPath = value;
59   }
60
61   return dataPath;
62 }
63
64 } // namespace SystemSettings
65
66 } // namespace Adaptor
67
68 } // namespace Internal
69
70 } // namespace Dali