Didn't I do that with Clean(, sep) ?


On Fri, Nov 15, 2013 at 9:32 AM, Keith Rarick <notifications@github.com>wrote:

> In filesystem.go:
>
> > @@ -33,4 +30,17 @@ func (f *fs) ReadDir(dirname string) ([]os.FileInfo, error) { return ioutil.Read
> >
> >  func (f *fs) Lstat(name string) (os.FileInfo, error) { return os.Lstat(name) }
> >
> > -func (f *fs) Join(elem ...string) string { return filepath.Join(elem...) }
> > +func (f *fs) PathSeparator() byte { return os.PathSeparator }
> > +
> > +// Join joins any number of path elements into a single path, adding
> > +// a Separator if necessary. The result is Cleaned, in particular
> > +// all empty strings are ignored.
> > +func Join(fs FileSystem, elem ...string) string {
> > +	sep := string(fs.PathSeparator())
> > +	for i, e := range elem {
> > +		if e != "" {
> > +			return filepath.Clean(strings.Join(elem[i:], sep))
>
> The behavior of filepath.Clean depends on the value of PathSeparator.
> So I guess we have to copy Clean (and FromSlash, etc) into this package.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/kr/fs/pull/5/files#r7675907>
> .
>