1 /*
2 * Copyright (C) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "graphics_manager.h"
17 #include "i_engine.h"
18 #include "platform_data.h"
19 #include "3d_widget_adapter_log.h"
20
21 namespace OHOS::Render3D {
GetPlatformData() const22 PlatformData GraphicsManager::GetPlatformData() const
23 {
24 #define TO_STRING(name) #name
25 #define PLATFORM_PATH_NAME(name) TO_STRING(name)
26 PlatformData data {
27 PLATFORM_PATH_NAME(PLATFORM_CORE_ROOT_PATH),
28 PLATFORM_PATH_NAME(PLATFORM_APP_ROOT_PATH),
29 PLATFORM_PATH_NAME(PLATFORM_APP_PLUGIN_PATH),
30 };
31 #undef TO_STRING
32 #undef PLATFORM_PATH_NAME
33 WIDGET_LOGD("platformdata %s, %s, %s,", data.coreRootPath_.c_str(),
34 data.appRootPath_.c_str(), data.appPluginPath_.c_str());
35 return data;
36 }
37
GetPlatformData(const HapInfo & hapInfo) const38 PlatformData GraphicsManager::GetPlatformData(const HapInfo& hapInfo) const
39 {
40 #define TO_STRING(name) #name
41 #define PLATFORM_PATH_NAME(name) TO_STRING(name)
42 PlatformData data {
43 PLATFORM_PATH_NAME(PLATFORM_CORE_ROOT_PATH),
44 PLATFORM_PATH_NAME(PLATFORM_APP_ROOT_PATH),
45 PLATFORM_PATH_NAME(PLATFORM_APP_PLUGIN_PATH),
46 hapInfo,
47 };
48 #undef TO_STRING
49 #undef PLATFORM_PATH_NAME
50 WIDGET_LOGD("platformdata %{public}s, %{public}s, %{public}s,", data.coreRootPath_.c_str(),
51 data.appRootPath_.c_str(), data.appPluginPath_.c_str());
52
53 WIDGET_LOGD("HapInfo %{public}s, %{public}s, %{public}s,", data.hapInfo_.hapPath_.c_str(),
54 data.hapInfo_.bundleName_.c_str(), data.hapInfo_.moduleName_.c_str());
55 return data;
56 }
57
GetInstance()58 GraphicsManager& GraphicsManager::GetInstance()
59 {
60 static GraphicsManager graphicsManager;
61 return graphicsManager;
62 }
63
~GraphicsManager()64 GraphicsManager::~GraphicsManager()
65 {}
66 } // namespace OHOS::Render3D
67