Skip to content

Commit b7bc0a9

Browse files
committed
codereview: removed toPosix function
1 parent c4d7c63 commit b7bc0a9

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

  • packages/react-native/scripts/ios-prebuild

packages/react-native/scripts/ios-prebuild/vfs.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ const {getHeaderFilesFromPodspecs} = headers;
1616

1717
const ROOT_PATH_PLACEHOLDER = '${ROOT_PATH}';
1818

19-
/**
20-
* Converts a path to use POSIX-style separators (forward slashes)
21-
*/
22-
function toPosix(value /*: string */) /*: string */ {
23-
return value.split(/[\\/]/).join('/');
24-
}
25-
2619
/**
2720
* Builds a hierarchical VFS directory structure from a list of header mappings.
2821
* Clang's VFS overlay requires a tree structure where directories contain their children.
@@ -67,7 +60,7 @@ function buildVFSStructure(
6760
roots.push({
6861
name: fileName,
6962
type: 'file',
70-
'external-contents': toPosix(sourcePath),
63+
'external-contents': sourcePath,
7164
});
7265
}
7366
}
@@ -100,7 +93,7 @@ function buildDirectoryEntry(
10093
contents.push({
10194
name: fileName,
10295
type: 'file',
103-
'external-contents': toPosix(sourcePath),
96+
'external-contents': sourcePath,
10497
});
10598
}
10699
}
@@ -203,7 +196,7 @@ function createVFSOverlayContents(rootFolder /*: string */) /*: VFSOverlay */ {
203196
headerMap.headers.forEach(header => {
204197
// The key is just the target path (the import path)
205198
// e.g., 'react/renderer/graphics/Size.h' for #import <react/renderer/graphics/Size.h>
206-
let key = toPosix(header.target);
199+
let key = header.target;
207200

208201
// If the podspec doesn't specify a header_dir, CocoaPods exposes public headers under
209202
// <PodName/Header.h> (and umbrella headers typically use quoted imports resolved relative
@@ -219,7 +212,7 @@ function createVFSOverlayContents(rootFolder /*: string */) /*: VFSOverlay */ {
219212
// The external-contents path is always podSpecName + header.target because
220213
// xcframework.js copies headers to: outputHeadersPath/podSpecName/headerFile.target
221214
// So the VFS must point to that same location.
222-
const sourcePath = `${ROOT_PATH_PLACEHOLDER}/Headers/${podSpecName}/${toPosix(header.target)}`;
215+
const sourcePath = `${ROOT_PATH_PLACEHOLDER}/Headers/${podSpecName}/${header.target}`;
223216

224217
mappings.push({
225218
key,

0 commit comments

Comments
 (0)