On Wed, May 13, 2009 at 4:07 PM, Brett Wilson <[email protected]> wrote:

> On Wed, May 13, 2009 at 3:51 PM, Amanda Walker <[email protected]>
> 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.

I also need to convert paths in the Collada file to relative paths in our
tgz files.  In order to do that, I need to be able to normalize the path to
the Collada file so I can normalize the paths to the referenced texture
files and strip off common base directories.

I'd really like to avoid the filesystem access too -- it's a real pain in
the ass to do, which is why it hasn't been done yet.  Currently, the user
has to tell me the string to strip off of the pathnames to make them
relative, and if files collide or split, then the output is just 2x bigger,
or just doesn't work.  I'd like to fix those things, but to do it right, I
need a better set of tools, and it seemed to me that if I was needing these
tools, then someone else could use them too.

-Greg.

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

Reply via email to