[chromium-dev] Re: Changes to FilePath?

2009-05-14 Thread Greg Spencer
On Wed, May 13, 2009 at 7:24 PM, Brett Wilson bre...@chromium.org wrote: You can't actually canonicalize a filename on Windows, so I think it's dangerous to write a component that claims to do it. You can do it under controlled conditions, and especially if the file exists on the disk already

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Greg Spencer
(ping) So, I had another idea. How about a separate file path manipulation class that has a well defined character encoding, so that we can do filename manipulations like with FilePath (and a few more). It could convert from a FilePath if given an encoding, and convert back to a FilePath with

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Mark Mentovai
If you've got a file that begins its life as something on-disk, and you just need to carry the path to it around, then that's fine, it should live its life as a FilePath. If you've got to create a file using some name where the name is some constant in code, use FilePath with ASCII constants.

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Darin Fisher
On Tue, Apr 28, 2009 at 2:47 PM, Greg Spencer gspen...@google.com wrote: On Tue, Apr 28, 2009 at 2:41 PM, Amanda Walker ama...@chromium.orgwrote: On Tue, Apr 28, 2009 at 4:39 PM, Greg Spencer gspen...@google.com wrote: 1) I'd like to add some explicit routines for converting to/from UTF8

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Greg Spencer
On Wed, May 13, 2009 at 1:03 PM, Mark Mentovai m...@chromium.org wrote: If you've got to take an arbitrary FilePath and convert it for display to the user, or take an arbitrary string in a known encoding and re-encode it for the filesystem, then we don't have anything in FilePath for this. I

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Greg Spencer
On Wed, May 13, 2009 at 2:05 PM, Darin Fisher da...@chromium.org wrote: That conversion is not defined. If you are on Linux, the contents of the file path is just an array of bytes. It might be UTF-8, in which case you can convert to UTF-16. However, it may also be some crazy encoding or it

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Scott Hess
This post made me think that we should have infrastructure so that certain unit tests can opt to run in a restricted environment to enforce that someone doesn't come along and add filesystem-access code or other known-bad synchronous APIs. I realize that that is probably hard, and that patches

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Amanda Walker
Perhaps what we need is a companion to FilePath. For example: FilePath: much as it is now, lightweight, alternative to string manipulation. FileReference: heavierweight, can talk to the file system and have carnal knowledge of platform specifics for things like resolving / canonicalizing

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Brett Wilson
On Wed, May 13, 2009 at 3:51 PM, Amanda Walker ama...@chromium.org wrote: Perhaps what we need is a companion to FilePath.  For example: FilePath: much as it is now, lightweight, alternative to string manipulation. FileReference: heavierweight, can talk to the file system and have carnal

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Amanda Walker
On Wed, May 13, 2009 at 7:07 PM, Brett Wilson bre...@chromium.org wrote: On Wed, May 13, 2009 at 3:51 PM, Amanda Walker ama...@chromium.org wrote: Perhaps what we need is a companion to FilePath.  For example: FilePath: much as it is now, lightweight, alternative to string manipulation.

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Darin Fisher
On Wed, May 13, 2009 at 2:20 PM, Greg Spencer gspen...@google.com wrote: On Wed, May 13, 2009 at 2:05 PM, Darin Fisher da...@chromium.org wrote: That conversion is not defined. If you are on Linux, the contents of the file path is just an array of bytes. It might be UTF-8, in which case you

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Brett Wilson
On Wed, May 13, 2009 at 4:34 PM, Amanda Walker ama...@chromium.org wrote: On Wed, May 13, 2009 at 7:07 PM, Brett Wilson bre...@chromium.org wrote: On Wed, May 13, 2009 at 3:51 PM, Amanda Walker ama...@chromium.org wrote: Perhaps what we need is a companion to FilePath.  For example:

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Greg Spencer
On Wed, May 13, 2009 at 4:35 PM, Darin Fisher da...@chromium.org wrote: The solution is to not convert to UTF-16 unless you are trying to generate a string to display to the user. Then you should use the LANG information to determine how best to render the text for display to the user.

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Greg Spencer
On Wed, May 13, 2009 at 4:07 PM, Brett Wilson bre...@chromium.org wrote: On Wed, May 13, 2009 at 3:51 PM, Amanda Walker ama...@chromium.org wrote: Perhaps what we need is a companion to FilePath. For example: FilePath: much as it is now, lightweight, alternative to string

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Brett Wilson
On Wed, May 13, 2009 at 6:12 PM, Greg Spencer gspen...@google.com wrote: On Wed, May 13, 2009 at 4:07 PM, Brett Wilson bre...@chromium.org wrote: On Wed, May 13, 2009 at 3:51 PM, Amanda Walker ama...@chromium.org wrote: Perhaps what we need is a companion to FilePath.  For example:

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Brett Wilson
On Wed, May 13, 2009 at 7:24 PM, Brett Wilson bre...@chromium.org wrote: On Wed, May 13, 2009 at 6:12 PM, Greg Spencer gspen...@google.com wrote: On Wed, May 13, 2009 at 4:07 PM, Brett Wilson bre...@chromium.org wrote: On Wed, May 13, 2009 at 3:51 PM, Amanda Walker ama...@chromium.org wrote:

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Darin Fisher
FYI: Don't use GetShortPathName. It isn't supported on some Windows systems. We had a significant number of users that could not use Firefox until we stopped using it. -Darin On Wed, May 13, 2009 at 7:29 PM, Brett Wilson bre...@chromium.org wrote: On Wed, May 13, 2009 at 7:24 PM, Brett

[chromium-dev] Re: Changes to FilePath?

2009-05-13 Thread Darin Fisher
I mean.. there's a registry setting or something that can be set to disable it.-darin On Wed, May 13, 2009 at 8:40 PM, Darin Fisher da...@chromium.org wrote: FYI: Don't use GetShortPathName. It isn't supported on some Windows systems. We had a significant number of users that could not use

[chromium-dev] Re: Changes to FilePath?

2009-04-29 Thread Mark Mentovai
Greg Spencer wrote: So there's currently no right way to do the conversion, but I still think that the FilePath constructor is probably in the best position to inspect LC_ALL, etc. and do as close to the right thing as possible.  I doubt most Linux developers even think about this, and so the

[chromium-dev] Re: Changes to FilePath?

2009-04-29 Thread Greg Spencer
On Wed, Apr 29, 2009 at 12:22 PM, Mark Mentovai m...@chromium.org wrote: I understand your problem. You're saying I have user-supplied data that I want to build a filename from, and I have this pathname that I want to display back to the user. I agree that it would be good to have a way to

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Thomas Van Lenten
On Tue, Apr 28, 2009 at 4:39 PM, Greg Spencer gspen...@google.com wrote: Hi Chromium Developers, I'm working on Google's O3D (http://code.google.com/p/o3d), and we (naturally) share some of Chrome's base classes for our code, including the very useful class FilePath. However, in using

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Evan Martin
On Tue, Apr 28, 2009 at 1:39 PM, Greg Spencer gspen...@google.com wrote: 1) I'd like to add some explicit routines for converting to/from UTF8 and UTF16.  While it's nice (and important) that FilePath uses the platform's native string, we've found that many third party libraries have made

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Greg Spencer
On Tue, Apr 28, 2009 at 1:57 PM, Thomas Van Lenten thoma...@chromium.orgwrote: On Tue, Apr 28, 2009 at 4:39 PM, Greg Spencer gspen...@google.com wrote: 4) Make sure we handle case sensitivity vs case preservation correctly. It's unclear to me that FilePath does this correctly on the Mac --

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Peter Kasting
On Tue, Apr 28, 2009 at 1:39 PM, Greg Spencer gspen...@google.com wrote: 1) I'd like to add some explicit routines for converting to/from UTF8 and UTF16. While it's nice (and important) that FilePath uses the platform's native string, we've found that many third party libraries have made

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Amanda Walker
On Tue, Apr 28, 2009 at 4:39 PM, Greg Spencer gspen...@google.com wrote: 1) I'd like to add some explicit routines for converting to/from UTF8 and UTF16.  While it's nice (and important) that FilePath uses the platform's native string, we've found that many third party libraries have made

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Greg Spencer
On Tue, Apr 28, 2009 at 2:31 PM, Peter Kasting pkast...@google.com wrote: On Tue, Apr 28, 2009 at 1:39 PM, Greg Spencer gspen...@google.com wrote: 1) I'd like to add some explicit routines for converting to/from UTF8 and UTF16. While it's nice (and important) that FilePath uses the

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Peter Kasting
On Tue, Apr 28, 2009 at 2:48 PM, Greg Spencer gspen...@google.com wrote: So, I was unable to find the conversion utilities in base that do the conversion to/from UTF8. What are they called? If I missed them (and I looked for a while before I gave up), then maybe they need to be more

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Erik Kay
(resend - arg) On Tue, Apr 28, 2009 at 2:47 PM, Greg Spencer gspen...@google.com wrote: On Tue, Apr 28, 2009 at 2:41 PM, Amanda Walker ama...@chromium.orgwrote: On Tue, Apr 28, 2009 at 4:39 PM, Greg Spencer gspen...@google.com wrote: 1) I'd like to add some explicit routines for

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Greg Spencer
On Tue, Apr 28, 2009 at 3:19 PM, Greg Spencer gspen...@google.com wrote: On Tue, Apr 28, 2009 at 3:11 PM, Erik Kay erik...@google.com wrote: The biggest problem with this change is that it's not possible to do this conversion on Linux in a safe way. And besides -- this problem isn't

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Erik Kay
On Tue, Apr 28, 2009 at 3:19 PM, Greg Spencer gspen...@google.com wrote: On Tue, Apr 28, 2009 at 3:11 PM, Erik Kay erik...@google.com wrote: The biggest problem with this change is that it's not possible to do this conversion on Linux in a safe way. In Linux, there is no charset defined by

[chromium-dev] Re: Changes to FilePath?

2009-04-28 Thread Greg Spencer
On Tue, Apr 28, 2009 at 3:26 PM, Erik Kay erik...@chromium.org wrote: On Tue, Apr 28, 2009 at 3:19 PM, Greg Spencer gspen...@google.com wrote: But that's exactly the point. FilePath is the class that created the path to begin with. So it can know what the LC_*/LANG variables were was when