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 #include <iostream>
17 #include "mtpfs_fuse.h"
18 #include "mtpfs_util.h"
19 #include "storage_service_log.h"
20
main(int argc,char ** argv)21 int main(int argc, char **argv)
22 {
23 if (!DelayedSingleton<MtpFileSystem>::GetInstance()->ParseOptions(argc, argv)) {
24 LOGE("mtpfs wrong usage, see %{public}s -h for details.", SmtpfsBaseName(argv[0]).c_str());
25 std::cout << "mtpfs wrong usage, see " << SmtpfsBaseName(argv[0]) << " -h for details.\n";
26 return 1;
27 }
28
29 bool success = DelayedSingleton<MtpFileSystem>::GetInstance()->Exec();
30 if (!success) {
31 LOGE("Exec mtpfs.bin to mount mtp device failed.");
32 std::cout << "Exec mtpfs to mount mtp device failed.\n";
33 return 1;
34 }
35
36 LOGI("Exec mtpfs.bin to mount mtp device success.");
37 return 0;
38 }
39