microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2166bdab04078d2a37e6331ce43e869d0ed0b7a4

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/debugger/ios/deviceDeployer.ts

33lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4import * as path from "path";
5import * as Q from "q";
6
7import {CommandExecutor} from "../../common/commandExecutor";
8import {Xcodeproj} from "../../common/ios/xcodeproj";
9import {ErrorHelper} from "../../common/error/errorHelper";
10import {InternalErrorCode} from "../../common/error/internalErrorCode";
11
12export class DeviceDeployer {
13 private projectRoot: string;
14
15 constructor(projectRoot: string) {
16 this.projectRoot = projectRoot;
17 }
18
19 public deploy(): Q.Promise<void> {
20 return new Xcodeproj().findXcodeprojFile(this.projectRoot).then((projectFile: string) => {
21 const projectName = path.basename(projectFile, path.extname(projectFile));
22 const pathToCompiledApp = path.join(this.projectRoot, "ios", "build",
23 "Build", "Products", "Debug-iphoneos", `${projectName}.app`);
24 return new CommandExecutor(this.projectRoot)
25 .spawnAndWaitForCompletion("ideviceinstaller", ["-i", pathToCompiledApp]).catch((err) => {
26 if ((<any>err).code === "ENOENT") {
27 throw ErrorHelper.getNestedError(err, InternalErrorCode.IDeviceInstallerNotFound);
28 }
29 throw err;
30 });
31 });
32 }
33}