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

Issue 11968012: Fix Path.relativeTo and add support for relative paths as input. (Closed)

Created:
7 years, 11 months ago by Bill Hesse
Modified:
7 years, 11 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fix Path.relativeTo and add support for relative paths as input. BUG=https://code.google.com/p/dart/issues/detail?id=7870 BUG=https://code.google.com/p/dart/issues/detail?id=7873 TEST=standalone/io/path_test Committed: https://code.google.com/p/dart/source/detail?r=17138

Patch Set 1 #

Total comments: 4

Patch Set 2 : Document that a.relativeTo(b.directoryPath) gives URL semantics. #

Patch Set 3 : #Just say '/' instead of 'path separator' in the doc comments. #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+104 lines, -46 lines) Patch
M sdk/lib/io/path.dart View 1 2 11 chunks +33 lines, -24 lines 0 comments Download
M sdk/lib/io/path_impl.dart View 1 chunk +25 lines, -14 lines 3 comments Download
M tests/standalone/io/path_test.dart View 2 chunks +46 lines, -8 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Bill Hesse
There is a one-line change in test_suite.dart needed, when the Dart executable in tools/testing/bin is ...
7 years, 11 months ago (2013-01-16 12:54:03 UTC) #1
Mads Ager (google)
The code looks good. I have one higher-level question. Going forward, maybe we need to ...
7 years, 11 months ago (2013-01-16 13:20:10 UTC) #2
Bill Hesse
https://codereview.chromium.org/11968012/diff/1/tests/standalone/io/path_test.dart File tests/standalone/io/path_test.dart (right): https://codereview.chromium.org/11968012/diff/1/tests/standalone/io/path_test.dart#newcode194 tests/standalone/io/path_test.dart:194: // Trailing slash in the base path has no ...
7 years, 11 months ago (2013-01-16 13:32:55 UTC) #3
Mads Ager (google)
LGTM I see you point about join as well. Thanks for adding the extra documentation. ...
7 years, 11 months ago (2013-01-16 13:47:28 UTC) #4
Bob Nystrom
I'm glad to see this operation getting more robust but it makes me sad to ...
7 years, 11 months ago (2013-01-16 18:42:38 UTC) #5
Bill Hesse
On 2013/01/16 18:42:38, Bob Nystrom wrote: > I'm glad to see this operation getting more ...
7 years, 11 months ago (2013-01-18 14:17:13 UTC) #6
Bob Nystrom
7 years, 11 months ago (2013-01-18 16:07:28 UTC) #7
Message was sent while issue was closed.
On 2013/01/18 14:17:13, Bill Hesse wrote:
> On 2013/01/16 18:42:38, Bob Nystrom wrote:
> > I'm glad to see this operation getting more robust but it makes me sad to
see
> > this much wheel re-invention going on. If you really want to flesh out the
> Path
> > class, why not copy code from pkg/path? It implements this fully with lots
of
> > tests, docs, corner cases, etc.
> > 
> > Have you considered at least using it as a reference?
> > 
> > https://codereview.chromium.org/11968012/diff/1006/sdk/lib/io/path_impl.dart
> > File sdk/lib/io/path_impl.dart (right):
> > 
> >
>
https://codereview.chromium.org/11968012/diff/1006/sdk/lib/io/path_impl.dart#...
> > sdk/lib/io/path_impl.dart:75: while (common < length && pathSegments[common]
> ==
> > baseSegments[common]) {
> > I believe this will do the wrong thing if you have drive letters that differ
> by
> > case or slash style.
> > 
> >
>
https://codereview.chromium.org/11968012/diff/1006/sdk/lib/io/path_impl.dart#...
> > sdk/lib/io/path_impl.dart:84: "  Arguments: $_path.relativeTo($base)");
> > Throwing an ArgumentError here is a trip-wire for the user. They can't
> > programmatically prevent this unless they reimplement the same logic that
this
> > method contains, and they shouldn't catch it because it's an Error.
> > 
> >
>
https://codereview.chromium.org/11968012/diff/1006/sdk/lib/io/path_impl.dart#...
> > sdk/lib/io/path_impl.dart:103: "  Arguments: $_path.relativeTo($base)");
> > Ditto here. This will give users a bad day.
> > 
> > pkg/path (like Python and Ruby) handle this by assuming a relative path is
> > relative to the cwd if that larger context is needed.
> 
> 
> I will fix the issues reported here, and a few formatting comments from Mads
> that I missed, and we have a plan for working together now in the future. 

Sounds great! Let me know if there's anything I can do to help.

- bob

Powered by Google App Engine
This is Rietveld 408576698