-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TreeFS, RootPathUtils: consistently preserve trailing separators in l…
…ookups Summary: Currently, `metro-file-map` has little/no consideration of paths with trailing slashes. These come up as we consider hierarchical lookups from module candidate paths with trailing slashes (but in any case, ought to have defined behaviour). This defines a consistent handling where input paths have trailing slashes, for `RootPathUtils` and `FileSystem` (`TreeFS`). - `absoluteToNormal` and `relativeToNormal` will *preserve* trailing slashes, except where the normal path is the project root (`''`), so we formalise that a `normalPath` may have a trailing slash. - A `lookup()` on `/foo/bar/` should succeed iff `/foo/bar` is a directory or a symlink to a directory (i.e., not if `/foo/bar` is a file), consistent with posix `ls`, `stat`, `realpath`, etc., which fail with `"Not a directory"`. - The returned `realPath` should drop any trailing slash (except for the fs root), as posix `realpath` does. In `metro-file-map`, `canonicalPath` never has a trailing slash, and maps 1-1 with a tree node. Reviewed By: GijsWeterings Differential Revision: D60773938 fbshipit-source-id: 77d1bac7caf27e0d125e7cd9f3d6190cd1305bef
- Loading branch information
1 parent
1e1dfe1
commit 5bdf051
Showing
4 changed files
with
103 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters