On Tue, Apr 28, 2009 at 3:26 PM, Erik Kay <erik...@chromium.org> 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 it
>> was created, and do the right conversion when you ask the FilePath to
>> convert to UTF16.  Also, if the developer calls something called
>> FilePath::CreateFromUTF8, then it can know it was supposed to be UTF8 and
>> remember that.
>
>
> If you created it yourself, that's fine.  FilePaths aren't always created
> manually by users.  They often are populated from system APIs where you
> can't know.  See file_util* for some examples.  So the problem is that if
> you add this API, people will mistakenly use the conversion functions when
> they can't be safe.  I agree it sucks.  I just don't know of a reasonable
> solution.

We have this problem already, when FilePaths need to work with
wstring-based APIs like the win32 one.
What we've done so far is use a function with an awkward name
(ToWStringHack, FromWStringHack) to try to create bias against them.

On the other hand, the codebase now has 309 lines containing
"WStringHack" so I don't know it's been too successful.

It might be worth figuring out a name that does what Greg needs that
is similarly awkward but doesn't involve "Hack" for circumstances
where you really just need to do the conversion.

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to