Fix CLI Error when there is no windows project

Summary:
Running `master` (at 260d68bf8b) I noticed `react-native link` fails when there is no windows project due to a bug in the code that fetches windows project configs (introduced 445182c707).

There's a guard to return early if `csSolution` (the relative path of the windows solution) is null but it needs to be a line earlier, because `path.join` errors when passed a non-string.

Tested locally on a non-windows project, `react-native link` errored previously and now succeeds.
Closes https://github.com/facebook/react-native/pull/11590

Differential Revision: D4362419

fbshipit-source-id: b3b9f6784d8b1d1a7c53abe0ee421b1dc6048571
This commit is contained in:
Rob Hogan 2016-12-22 10:43:23 -08:00 committed by Facebook Github Bot
parent f625437ee9
commit 59276468f2
1 changed files with 1 additions and 1 deletions

View File

@ -34,13 +34,13 @@ const getProjectName = (fullProjPath) => {
exports.projectConfig = function projectConfigWindows(folder, userConfig) {
const csSolution = userConfig.csSolution || findWindowsSolution(folder);
const solutionPath = path.join(folder, csSolution);
if (!csSolution) {
return null;
}
// expects solutions to be named the same as project folders
const solutionPath = path.join(folder, csSolution);
const windowsAppFolder = csSolution.substring(0, csSolution.lastIndexOf(".sln"));
const src = userConfig.sourceDir || windowsAppFolder;
const sourceDir = path.join(folder, src);