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

Issue 5349007: Some additions to support symlinks better on platforms that support them. (Closed)

Created:
10 years ago by Greg Spencer (Chromium)
Modified:
9 years, 7 months ago
Reviewers:
Evan Martin
CC:
chromium-reviews, Paweł Hajdan Jr., pam+watch_chromium.org, brettw-cc_chromium.org
Visibility:
Public.

Description

Some additions to support symlinks better on platforms that support them. BUG=none TEST=Ran new unit test, passed trybots. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=67631

Patch Set 1 #

Total comments: 4

Patch Set 2 : review changes #

Patch Set 3 : removing TODO #

Unified diffs Side-by-side diffs Delta from patch set Stats (+78 lines, -11 lines) Patch
M base/file_util.h View 1 2 1 chunk +8 lines, -0 lines 0 comments Download
M base/file_util_posix.cc View 1 1 chunk +23 lines, -0 lines 0 comments Download
M base/file_util_unittest.cc View 4 chunks +40 lines, -11 lines 0 comments Download
M base/platform_file.h View 1 chunk +3 lines, -0 lines 0 comments Download
M base/platform_file_posix.cc View 1 chunk +1 line, -0 lines 0 comments Download
M base/platform_file_unittest.cc View 2 chunks +2 lines, -0 lines 0 comments Download
M base/platform_file_win.cc View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Greg Spencer (Chromium)
I developed this a while ago while working on some ChromeOS code that was manipulating ...
10 years ago (2010-11-29 20:52:37 UTC) #1
Evan Martin
In general, we end up with a copy of this code in every Chrome-derived binary; ...
10 years ago (2010-11-29 21:21:14 UTC) #2
Greg Spencer (Chromium)
10 years ago (2010-11-29 21:34:11 UTC) #3
Yes, it's my intention to start using this in the ChromeOS code once it's
available.  (This was a separable change, so I separated it.)

http://codereview.chromium.org/5349007/diff/1/base/file_util_posix.cc
File base/file_util_posix.cc (right):

http://codereview.chromium.org/5349007/diff/1/base/file_util_posix.cc#newcode390
base/file_util_posix.cc:390: if (count > 0) {
On 2010/11/29 21:21:14, Evan Martin wrote:
> Consider an early return pattern here instead (if (count <= 0) return false;)

Done.

http://codereview.chromium.org/5349007/diff/1/base/file_util_posix.cc#newcode391
base/file_util_posix.cc:391: *target_path = FilePath(FilePath::StringType(buf,
count));
On 2010/11/29 21:21:14, Evan Martin wrote:
> Can use std::string here, since we know the string type.

I prefer to use the actual type that FilePath expects, actually.  I'm aware that
StringType is just a typedef for std::string on posix, but if that ever changed,
or this code were ported to other platforms, using the StringType here makes it
a lot easier to find instances that are supposed to be interpreted as FilePaths
as opposed to strings used for other purposes (i.e. it's more self documenting).

For this particular instance, this isn't a huge deal, but as a coding practice,
I think it is.

Powered by Google App Engine
This is Rietveld 408576698