-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add comments and clear up some of the code in preparation for SE-0021… #565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Seems ok to me... |
… (test naming convention) changes.
9a4c698 to
af383d0
Compare
…ng a merge conflict.
| } | ||
|
|
||
| /// Returns path to all the items in a directory. | ||
| /// FIXME: This is generic functionality, and should move to FileSystem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually Daniel suggested that we don't keep this in filesystem/utility because clients almost always endup needing the entry name. If the method provides full path client will extract the basename from path which is a waste. So I put this method until we can refactor the PackageBuilder code to not use AbsolutePath at all. I should have added that FIXME here, my bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would PackageBuilder switch off of AbsolutePath? Would it just be using strings again?
Note that I'm not for a moment saying we should remove the ability to get the just the names of the entries: that's a fundamental building block of directory access. But instead of having every client construct their own AbsolutePaths, there should also be a way to iterate over subpaths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No no, it will use relative paths to the sources instead of absolute ones. So you can pass in a rerooted filesystem and get modules out of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats a typo above... *AbsolutePath -> absolute path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the discussion about rerooted fs: #521 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the link to #521. But it seems orthogonal to me, because part of the point of FileSystem is that the client code (PackageBuilder in this case) shouldn't need to know or care whether it's given a file system that maps directly to the underlying file system, to a git repo or cpio file or whatever, or to a RerootedFileSystemView on top of one of those other kinds of file system.
In all cases the API deals in terms of just paths (currently called AbsolutePath but eventually intending to be renamed to Path). And it doesn't change the fact that sometimes you want to walk a file system hierarchy. Other times you just want to get the names of the entries in a single directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good way to think of it is as a stack of file systems. A RerootedFileSystemView just means that you can pretend that everything exists at the top level of the file system, but other than that it isn't any different from any other file system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use absolute paths here because Sources takes absolute paths, it can be refactored to contain only relative paths and only probably the module would be aware of its base path. After that point PackageLoader should be able to work with a rerooted fs. You're right this method is orthogonal to all this but once that is in, this function should not be needed anymore (ofcourse until we need this kind of facility somewhere else).
… (test naming convention) changes.