microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
c96fc63e7988ad4a1eb0bb67436b37dd20f7f1e6

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/common/ios/xcodeproj.ts

34lines · 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 {ErrorHelper} from "../../common/error/errorHelper";
8import {Log} from "../../common/log/log";
9import {FileSystem} from "../../common/node/fileSystem";
10
11import {TelemetryHelper} from "../../common/telemetryHelper";
12
13export class Xcodeproj {
14 private nodeFileSystem: FileSystem;
15
16 constructor({
17 nodeFileSystem = new FileSystem(),
18 } = {}) {
19 this.nodeFileSystem = nodeFileSystem;
20 }
21
22 public findXcodeprojFile(projectRoot: string): Q.Promise<string> {
23 projectRoot = projectRoot.match(/(.*)ios\/?$/) ? projectRoot.match(/(.*)ios\/?$/)[1] : projectRoot;
24 return this.nodeFileSystem
25 .findFilesByExtension(path.join(projectRoot, "ios"), "xcodeproj")
26 .then((projectFiles: string[]) => {
27 if (projectFiles.length > 1) {
28 TelemetryHelper.sendSimpleEvent("multipleXcodeprojFound");
29 Log.logWarning(ErrorHelper.getWarning(`More than one xcodeproj found. Using ${projectFiles[0]}`));
30 }
31 return projectFiles[0];
32 });
33 }
34}