1 /* 2 * Copyright (c) 2021-2022 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 "virtual_device.h" 17 main(int32_t argc,const char * argv[])18int32_t main(int32_t argc, const char *argv[]) 19 { 20 if (argc == 1 || argc > PARAMETERS_NUMBER) { 21 std::cout << "Invalid Input Para, Please Check the validity of the para" << std::endl; 22 return 0; 23 } 24 DIR* dir = opendir(OHOS::MMI::g_folderPath.c_str()); 25 if (dir == nullptr) { 26 mkdir(OHOS::MMI::g_folderPath.c_str(), SYMBOL_FOLDER_PERMISSIONS); 27 } else { 28 if (closedir(dir) != 0) { 29 std::cout << "Close dir:" << OHOS::MMI::g_folderPath << "failed" << std::endl; 30 } 31 } 32 std::vector<std::string> argvList; 33 for (uint16_t i = 0; i < argc; i++) { 34 argvList.push_back(argv[i]); 35 } 36 if (!OHOS::MMI::VirtualDevice::CommandBranch(argvList)) { 37 return 0; 38 } 39 static constexpr std::int32_t usleepTime = 1500000; 40 while (true) { 41 usleep(usleepTime); 42 } 43 44 return 0; 45 } 46