Skip to content

Conversation

@aciidgh
Copy link
Contributor

@aciidgh aciidgh commented Jul 22, 2016

No description provided.

@aciidgh aciidgh force-pushed the walk-filesystem branch 2 times, most recently from b549366 to 1f5eddb Compare July 22, 2016 16:11
if !fileSystem.isFile(path) { return false }
guard let ext = path.suffix else { return false }
// FIXME: This isn't efficient.
return validExtensions.contains(String(ext.utf8.dropFirst()))
Copy link
Contributor

@ddunbar ddunbar Jul 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a method on path to get this (the extension, defined to be the suffix without the .).

/cc @abertelrud any objections to that name?

@aciidgh aciidgh force-pushed the walk-filesystem branch 2 times, most recently from 142c29b to fb6b836 Compare July 22, 2016 20:38
@aciidgh
Copy link
Contributor Author

aciidgh commented Jul 22, 2016

@ddunbar Updated and rebased this

public init(manifest: Manifest, path: AbsolutePath, fileSystem: FileSystem = localFileSystem) {
self.manifest = manifest
self.packagePath = path
self.fileSystem = fileSystem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I wanted to do as part of this was to rewrite the logic to use a FileSystem rooted at packagePath (using RerootedFileSystem, when dealing with a local FS)... do you think that makes sense, and is it best as a separate commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably will be better as separate. Also, do you mean PackageBuilder reroots it or the client/caller?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually I think the PackageBuilder should assume it is given a rerooted one, but that might need to be staged in.

The use case I am working towards is that we can run PackageBuilder directly against a git repository that doesn't even exist in the file system.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(for example, I am trying to get it so that lower-level things are agnostic to the actual paths of things, so we can guarantee it is safe to share them)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds cool! I tried it a bit current system is tied a lot to AbsolutePath, Rerooting will need some refactoring. Will add to TODO

@ddunbar
Copy link
Contributor

ddunbar commented Jul 22, 2016

LGTM, I wonder if we can continue to simplify things so directoryContents isn't needed (it feels like an odd bit of infrastructure to have hanging out here), but I'm not sure...

@ddunbar ddunbar merged commit 8961233 into swiftlang:master Jul 22, 2016
@aciidgh
Copy link
Contributor Author

aciidgh commented Jul 22, 2016

I tried getting rid of directoryContents but current code loves path too much. Its mostly not needed IMO but there are couple of filters which checks if its a valid file/dir which needs full path... we can probably do something eventually. I was thinking about returning a tuple of name and path but that seemed like it would be too much trouble right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants