1 /*
2  * Copyright (c) 2021 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 "application_env_impl.h"
17 #include "application_info.h"
18 
19 namespace OHOS {
20 namespace AppExecFwk {
21 /**
22  * @brief Sets L1 information about the runtime environment of the application to which the
23  *        ability belongs, including the bundle name, source code path, and data path.
24  * @param appInfo
25  * @return void
26  */
SetAppInfo(const AppInfo & appInfo)27 void ApplicationEnvImpl::SetAppInfo(const AppInfo &appInfo)
28 {
29     bundleName_ = appInfo.bundleName;
30     dataPath_ = appInfo.dataPath;
31     srcPath_ = appInfo.srcPath;
32 }
33 
34 /**
35  * @brief Sets information about the runtime environment of the application to which the
36  *        ability belongs, including the bundle name, source code path, and data path.
37  * @param appInfo indicates
38  * @return void
39  */
SetAppInfo(const ApplicationInfo & appInfo)40 void ApplicationEnvImpl::SetAppInfo(const ApplicationInfo &appInfo)
41 {
42     bundleName_ = appInfo.bundleName;
43     dataPath_ = appInfo.dataDir;
44     srcPath_ = appInfo.codePath;
45 }
46 
47 /**
48  * @brief Gets the bundlename of the application's runtime environment
49  * @param -
50  * @return bundleName
51  */
GetBundleName() const52 const std::string &ApplicationEnvImpl::GetBundleName() const
53 {
54     return bundleName_;
55 }
56 
57 /**
58  * @brief Gets the SrcPath of the application's runtime environment
59  * @param -
60  * @return SrcPath
61  */
GetSrcPath() const62 const std::string &ApplicationEnvImpl::GetSrcPath() const
63 {
64     return srcPath_;
65 }
66 
67 /**
68  * @brief Gets the DataPath of the application's runtime environment
69  * @param -
70  * @return DataPath
71  */
GetDataPath() const72 const std::string &ApplicationEnvImpl::GetDataPath() const
73 {
74     return dataPath_;
75 }
76 }  // namespace AppExecFwk
77 }  // namespace OHOS
78