Skip to content

Commit

Permalink
fix: use forward slashes instead of path.sep in iOS link (react-nativ…
Browse files Browse the repository at this point in the history
…e-community#618)

because react-native link on Windows gives incorrect path separator for Xcode.
  • Loading branch information
Taym Haddadi authored and thymikee committed Aug 7, 2019
1 parent 7350e0e commit 53f51ef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/platform-ios/src/link/getHeaderSearchPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import {last, union} from 'lodash';
*/
const getOuterDirectory = directories =>
directories.reduce((topDir, currentDir) => {
const currentFolders = currentDir.split(path.sep);
const topMostFolders = topDir.split(path.sep);
const currentFolders = currentDir.split('/');
const topMostFolders = topDir.split('/');

if (
currentFolders.length === topMostFolders.length &&
last(currentFolders) !== last(topMostFolders)
) {
return currentFolders.slice(0, -1).join(path.sep);
return currentFolders.slice(0, -1).join('/');
}

return currentFolders.length < topMostFolders.length ? currentDir : topDir;
Expand All @@ -53,8 +53,8 @@ export default function getHeaderSearchPath(sourceDir, headers) {
const directories = union(headers.map(path.dirname));

return directories.length === 1
? `"$(SRCROOT)${path.sep}${path.relative(sourceDir, directories[0])}"`
: `"$(SRCROOT)${path.sep}${path.relative(
? `"$(SRCROOT)/${path.relative(sourceDir, directories[0])}"`
: `"$(SRCROOT)/${path.relative(
sourceDir,
getOuterDirectory(directories),
)}/**"`;
Expand Down

0 comments on commit 53f51ef

Please sign in to comment.