1 /* 2 * Copyright (c) 2024 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 #ifndef FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_BUNDLE_CLONE_COMMON_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_BUNDLE_CLONE_COMMON_H 18 19 #include <string> 20 #include "bundle_constants.h" 21 22 namespace OHOS { 23 namespace AppExecFwk { 24 namespace { 25 const std::string CLONE_DIR_PATH_PREFIX = "clone"; 26 const std::string PLUS_SIGN = "+"; 27 const std::string MINUS_SIGN = "-"; 28 } 29 30 class BundleCloneCommonHelper { 31 public: GetCloneDataDir(const std::string & bundleName,const int32_t appIndex)32 static std::string GetCloneDataDir(const std::string &bundleName, const int32_t appIndex) 33 { 34 return PLUS_SIGN + CLONE_DIR_PATH_PREFIX + MINUS_SIGN + std::to_string(appIndex) + PLUS_SIGN + bundleName; 35 } 36 GetCloneBundleIdKey(const std::string & bundleName,const int32_t appIndex)37 static std::string GetCloneBundleIdKey(const std::string &bundleName, const int32_t appIndex) 38 { 39 return std::to_string(appIndex) + CLONE_DIR_PATH_PREFIX + Constants::FILE_UNDERLINE + bundleName; 40 } 41 }; 42 } // namespace AppExecFwk 43 } // namespace OHOS 44 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INNER_BUNDLE_CLONE_COMMON_H