Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Issue 11553005: Move path-manipulation code from io.dart into path.dart. (Closed)

Created:
8 years ago by nweiz
Modified:
8 years ago
Reviewers:
Bob Nystrom
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Move path-manipulation code from io.dart into path.dart. Committed: https://code.google.com/p/dart/source/detail?r=16063

Patch Set 1 #

Total comments: 58

Patch Set 2 : Code review changes #

Patch Set 3 : Bug fix #

Patch Set 4 : Code review changes + relative fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+340 lines, -133 lines) Patch
M utils/pub/io.dart View 1 2 3 3 chunks +10 lines, -67 lines 0 comments Download
M utils/pub/path.dart View 1 2 3 10 chunks +151 lines, -42 lines 0 comments Download
M utils/tests/pub/path/path_posix_test.dart View 1 2 3 5 chunks +83 lines, -9 lines 0 comments Download
M utils/tests/pub/path/path_windows_test.dart View 1 2 3 5 chunks +96 lines, -15 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
nweiz
Keeping track of separators and treating "a/" as different than "a" caused me headaches when ...
8 years ago (2012-12-11 23:31:30 UTC) #1
Bob Nystrom
https://codereview.chromium.org/11553005/diff/1/utils/pub/path.dart File utils/pub/path.dart (right): https://codereview.chromium.org/11553005/diff/1/utils/pub/path.dart#newcode62 utils/pub/path.dart:62: /// Returns the root of [path], if it's absolute, ...
8 years ago (2012-12-12 00:01:20 UTC) #2
nweiz
https://codereview.chromium.org/11553005/diff/1/utils/pub/path.dart File utils/pub/path.dart (right): https://codereview.chromium.org/11553005/diff/1/utils/pub/path.dart#newcode62 utils/pub/path.dart:62: /// Returns the root of [path], if it's absolute, ...
8 years ago (2012-12-12 00:50:37 UTC) #3
Bob Nystrom
https://codereview.chromium.org/11553005/diff/1/utils/pub/path.dart File utils/pub/path.dart (right): https://codereview.chromium.org/11553005/diff/1/utils/pub/path.dart#newcode62 utils/pub/path.dart:62: /// Returns the root of [path], if it's absolute, ...
8 years ago (2012-12-12 01:02:13 UTC) #4
nweiz
This latest batch of changes also fixes Builder.relative so that it doesn't access the current ...
8 years ago (2012-12-12 02:45:57 UTC) #5
Bob Nystrom
8 years ago (2012-12-12 04:52:33 UTC) #6
LGTM!

https://codereview.chromium.org/11553005/diff/1/utils/pub/path.dart
File utils/pub/path.dart (right):

https://codereview.chromium.org/11553005/diff/1/utils/pub/path.dart#newcode131
utils/pub/path.dart:131: /// If the [to] argument is passed, [path] is made
relative to that instead.
On 2012/12/12 02:45:57, nweiz wrote:
> On 2012/12/12 01:02:13, Bob Nystrom wrote:
> > On 2012/12/12 00:50:37, nweiz wrote:
> > > On 2012/12/12 00:01:20, Bob Nystrom wrote:
> > > > I don't like reinterpreting one argument based on whether or not another
> one
> > > was
> > > > passed. Can you do "from:" instead of "to:" here?
> > > 
> > > The idea is that it returns "path" relative to "to". "to" is effectively
> short
> > > for "relativeTo".
> > > 
> > > I'm going to change it to "base" to sidestep any attempts to think of it
as
> an
> > > English phrase, since that can evidently be interpreted in two conflicting
> > ways.
> > 
> > Before I accidentally lost the implementation, I was using from: here, and I
> > liked it:
> > 
> > path.relative('foo/bar', from: 'foo') -> 'bar'
> 
> That reads as "'foo/bar' relative from 'foo'" to me, which sounds awkward, but
> if you like it I'll make the switch.

Yeah, I like it a bit more. I read it as "get a path relative to 'foo/bar' from
'foo'" which has the nouns in about the right order.

https://codereview.chromium.org/11553005/diff/1/utils/tests/pub/path/path_pos...
File utils/tests/pub/path/path_posix_test.dart (right):

https://codereview.chromium.org/11553005/diff/1/utils/tests/pub/path/path_pos...
utils/tests/pub/path/path_posix_test.dart:133: expect(builder.join('a', null),
equals('a'));
On 2012/12/12 02:45:57, nweiz wrote:
> On 2012/12/12 01:02:13, Bob Nystrom wrote:
> > On 2012/12/12 00:50:37, nweiz wrote:
> > > On 2012/12/12 00:01:20, Bob Nystrom wrote:
> > > > Everything else doesn't use explicit equals() here. I don't think it
adds
> > any
> > > > value and it adds more boilerplate to the tests.
> > > 
> > > Every other test in Dart (not to mention Pub) uses it; I think we should
> > follow
> > > the project style.
> > 
> > This will get pulled out of pub before too long, so consistency there
doesn't
> > matter much to me. What's so bad about this? It's a well-defined part of the
> > unittest API?
> 
> In everything else we stick with the Dart project style. We even poke fun at
> dart2js for not following Dart style. It's certainly the Dart style to use
> equals() explicitly, and I feel like we should follow the Dart style even when
> we don't like it if we expect others to do the same.

Sure, if it matters that much to you. In that case, I wonder if it's worth
making little one line convenience functions:

expectJoin(arg, expected) {
  expect(builder.join(arg), equals(expected));
}

I'm just trying to minimize the clutter around the args and expected result.
Either way though, I'm fine with changing it.

Powered by Google App Engine
This is Rietveld 408576698