microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/common/ios/xcodeproj.ts
33lines · modeblame
afc46a73Jimmy Thomson10 years ago | 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 | | |
a4a7e387Meena Kunnathur Balakrishnan10 years ago | 7 | import {ErrorHelper} from "../../common/error/errorHelper"; |
190e393cMeena Kunnathur Balakrishnan10 years ago | 8 | import {Log} from "../../common/log/log"; |
db80cd4eJimmy Thomson10 years ago | 9 | import {FileSystem} from "../../common/node/fileSystem"; |
afc46a73Jimmy Thomson10 years ago | 10 | |
24c4c0aaJimmy Thomson10 years ago | 11 | import {TelemetryHelper} from "../../common/telemetryHelper"; |
| 12 | | |
afc46a73Jimmy Thomson10 years ago | 13 | export class Xcodeproj { |
81226dceJimmy Thomson10 years ago | 14 | private nodeFileSystem: FileSystem; |
| 15 | | |
| 16 | constructor({ | |
| 17 | nodeFileSystem = new FileSystem() | |
| 18 | } = {}) { | |
| 19 | this.nodeFileSystem = nodeFileSystem; | |
| 20 | } | |
| 21 | | |
afc46a73Jimmy Thomson10 years ago | 22 | public findXcodeprojFile(projectRoot: string): Q.Promise<string> { |
81226dceJimmy Thomson10 years ago | 23 | return this.nodeFileSystem |
afc46a73Jimmy Thomson10 years ago | 24 | .findFilesByExtension(path.join(projectRoot, "ios"), "xcodeproj") |
| 25 | .then((projectFiles: string[]) => { | |
| 26 | if (projectFiles.length > 1) { | |
642490c1Jimmy Thomson10 years ago | 27 | TelemetryHelper.sendSimpleEvent("multipleXcodeprojFound"); |
a4a7e387Meena Kunnathur Balakrishnan10 years ago | 28 | Log.logWarning(ErrorHelper.getWarning(`More than one xcodeproj found. Using ${projectFiles[0]}`)); |
afc46a73Jimmy Thomson10 years ago | 29 | } |
| 30 | return projectFiles[0]; | |
| 31 | }); | |
| 32 | } | |
| 33 | } |