Sunday, December 23, 2007


Finally, I have finished and tested the windows disk device component handling for folders. I still need to handle files but I doubt that will take long.

What this means is that I can now browse the file system and mount directories like this:

   1: FSDevice * Storage;
   2: FSFolder * Users;
   3: FSFolder * Home;
   4: /* Get a handle to the disk storage device */
   5: Storage = FSDiskDevice();
   6: /* Mount the storage */
   7: FSDeviceMount(Storage);
   8: /* Get the users folder in the c drive */
   9: Users = CoreObjectBrowse("/system/device/disk/c/users/");
  10: /* Mount the users folder */
  11: FSFolderMount(Users);
  12: /* Get the home folder under the mounted users folder */
  13: Home = CoreObjectFindByName(Users, "home");
  14: /* Mount the home folder */
  15: FSFolderMount(Home);

Notice that the only thing that specifies the usage of the disk file system is the FSDiskDevice function. All the rest of the code is abstract (apart from the path of course). I only need the device for mounting it which could easily be browsed for and then mounted so I can mount a device even if I don't know its type.

To avoid too much memory usage (I learned the hard way), you can mount and un-mount each folder separately. I am sure that the GUI will do this for you, but from a developer perspective this makes sense to have control over it. Note that any object can be mounted if it responds to the FSFolderMount method. So a zip folder could be mounted (if I wrote a zip FS device of course) so you could browse its contents after it was mounted.

1 comment:

Alphasmart User said...

nice progress! keep it up!