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

Issue 11638021: Make dirname and basename ignore trailing separators and double slashes. (Closed)

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

Description

Make dirname and basename ignore trailing separators and double slashes. Separators are still preserved for other path methods. Committed: https://code.google.com/p/dart/source/detail?r=16397

Patch Set 1 #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+101 lines, -49 lines) Patch
M pkg/path/lib/path.dart View 9 chunks +57 lines, -28 lines 7 comments Download
M pkg/path/test/path_posix_test.dart View 4 chunks +21 lines, -9 lines 2 comments Download
M pkg/path/test/path_windows_test.dart View 4 chunks +23 lines, -12 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
nweiz
8 years ago (2012-12-19 21:20:10 UTC) #1
Bob Nystrom
Two suggestions but LGTM. https://codereview.chromium.org/11638021/diff/1/pkg/path/lib/path.dart File pkg/path/lib/path.dart (right): https://codereview.chromium.org/11638021/diff/1/pkg/path/lib/path.dart#newcode239 pkg/path/lib/path.dart:239: parsed.removeTrailingSeparators(); Is this redundant with ...
8 years ago (2012-12-20 02:27:28 UTC) #2
nweiz
https://codereview.chromium.org/11638021/diff/1/pkg/path/lib/path.dart File pkg/path/lib/path.dart (right): https://codereview.chromium.org/11638021/diff/1/pkg/path/lib/path.dart#newcode239 pkg/path/lib/path.dart:239: parsed.removeTrailingSeparators(); On 2012/12/20 02:27:28, Bob Nystrom wrote: > Is ...
8 years ago (2012-12-20 20:54:49 UTC) #3
Bob Nystrom
8 years ago (2012-12-20 21:32:57 UTC) #4
Message was sent while issue was closed.
LGTM!

https://codereview.chromium.org/11638021/diff/1/pkg/path/lib/path.dart
File pkg/path/lib/path.dart (right):

https://codereview.chromium.org/11638021/diff/1/pkg/path/lib/path.dart#newcod...
pkg/path/lib/path.dart:477: for (var i = parsed.parts.length - 1; i >= 0; i--) {
On 2012/12/20 20:54:49, nweiz wrote:
> On 2012/12/20 02:27:28, Bob Nystrom wrote:
> > This is pretty hairy. One option would to have _ParsedPath have a separate
> field
> > for the trailing slashes (if any) instead of having a bunch of empty parts.
> > Parsing gets a bit more complicated, but it localizes that complexity there.
> > 
> > Thoughts?
> 
> It's not just trailing slashes that cause empty components; any path with
> multiple slashes anywhere will have empty components. Leaving the trailing
> slashes as empty components at least makes the handling uniform between those
> two cases.

Ah, right.

Powered by Google App Engine
This is Rietveld 408576698