microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/common/ios/xcodeproj.ts
32lines · 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 | |
| 4 | import * as path from "path"; |
| 5 | import * as Q from "q"; |
| 6 | |
| 7 | import {Log} from "../../common/log"; |
| 8 | import {FileSystem} from "../../common/node/fileSystem"; |
| 9 | |
| 10 | import {TelemetryHelper} from "../../common/telemetryHelper"; |
| 11 | |
| 12 | export class Xcodeproj { |
| 13 | private nodeFileSystem: FileSystem; |
| 14 | |
| 15 | constructor({ |
| 16 | nodeFileSystem = new FileSystem() |
| 17 | } = {}) { |
| 18 | this.nodeFileSystem = nodeFileSystem; |
| 19 | } |
| 20 | |
| 21 | public findXcodeprojFile(projectRoot: string): Q.Promise<string> { |
| 22 | return this.nodeFileSystem |
| 23 | .findFilesByExtension(path.join(projectRoot, "ios"), "xcodeproj") |
| 24 | .then((projectFiles: string[]) => { |
| 25 | if (projectFiles.length > 1) { |
| 26 | TelemetryHelper.sendSimpleEvent("multipleXcodeprojFound"); |
| 27 | Log.logWarning(`More than one xcodeproj found. Using ${projectFiles[0]}`); |
| 28 | } |
| 29 | return projectFiles[0]; |
| 30 | }); |
| 31 | } |
| 32 | } |