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 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: > >>> > > >>> > 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 pathnames, determining whether or not they refer to > the > >>> > same files, generating C strings that can be passed to 3rd party > >>> > libraries, etc. > >>> > >>> I think this is very dangerous. > >>> > >>> I think Greg should not be talking to the filesystem when inserting > >>> filenames into a set. We don't allow filesystem access from the UI > >>> thread of Chrome, and I think other parts of our system should also > >>> not do filesystem access on their critical threads, especially if they > >>> want to be more part of Chrome in the future. > >> > >> Well, so the use I have for this in O3D at the moment is in our > importer, > >> which currently is a separate command-line tool that reads Collada files > and > >> writes out our wire format for geometry. So it isn't meant to be > occuring > >> in a UI thread, but I could see times when it might be useful to know > for > >> sure if two files reference the same file in the UI thread (dragging and > >> dropping a file onto a drop zone, for instance). > >> I do need to know if I have the same file more than once in a set > because > >> the COLLADA file might reference the same texture multiple times, or > (more > >> dangerous) it might reference a file that is one file on Windows, > >> but (incorrectly) maps to two different files in the (Unix-path-format) > .tgz > >> files. To detect that, I need canonicalization. > > > > You can't actually canonicalize a filename on Windows, so I think it's > > dangerous to write a component that claims to do it. > > I guess you could call GetShortPathName every time you see a name. But > I think that's a crazy solution. I still think you should do my > suggestion below. > > > > I think you just need to come up with some simple rules that makes it > > work most of the time. Personally I would do ASCII lowercasing and > > stop worrying about it. If you use ICU to lower-case "correctly," > > Windows won't necessarily agree and you won't be able to use that > > file. > > > > --~--~---------~--~----~------------~-------~--~----~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~----------~----~----~----~------~----~------~--~---