Results 1 to 3 of 3

Thread: VirtualFileSystem (ClanLib 0.9)

  1. #1
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default VirtualFileSystem (ClanLib 0.9)

    I have an issue with the CL_VirtualDirectory::open_file
    If the file system has not been set, then it uses CL_File(filename, mode, access, share, flags)
    Else, it uses the file system open_file(filename) - Rejecting mode, access, share and flags.

    I suggest adding these to open_file in the virtual file system.
    See Attached Patch.

    However, i guess that there was a reason that it was not included? Maybe Virtual File System is read only?

    Also my patch uses "CL_File flags", but the provider may not be a file.

    Any comments?
    Attached Files Attached Files

  2. #2
    Master Sorcerer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    The VFS is simply missing those extra parameters. Originally neither took them, but then it always opened files in read+write mode, which caused problems when you wanted to open files placed in program files directories and similar places.

    The quick hack was to add the parameters exactly for the places where I needed it, which is why VFS didn't get updated at the time.

    The basic idea of the VFS is that it abstracts file systems so ClanLib can use the same code to read from a real FS, a jailed FS (i.e. a VFS that only lets you read from a Resources directory) and a archived (zip) FS. Ideally you can write to any of those file systems and it should also be possible create a VFS where it is marked as read-only.

    The biggest issue with the VFS design at the moment is path handling. Paths slightly differ based on which of these FS are being targeted. The true virtual file systems (jailed and zip) require that any path cannot escape the root of the file system, so if you created a VFS that points to a Resources directory, then no matter what an application tells it to load, it will never load anything outside this directory. This is particular important to allow a clanlib game to safely download and mount archives into a VFS and effectively jail user-contributed content this way. On the other hand, any path given to a real FS being abstracted by CL_VirtualDirectory needs to be dealt with as if the guy had just used CL_File directly.

  3. #3
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Patch applied

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •