Or at least, an emulated Mac.

Since the cross-platform file library takes care of most of the details, there are really only two routines that OS specific.

The routine fillDrivesList() populates the drives list with the mounted drives, and displays the user's drive.

The getDrives() returns a list of hard drives on the machine. For Windows, it searches A-Z to determine which (if any) of these drives are valid.

I've not had a chance to write up the Linux/OS X equivalent, but Google says that something along the lines of:

 df -h --output=source,target 

should provide a list of mounted drives. And indeed, it works fine under Ubuntu.

For the Mac, Google also suggests:

 diskutil list 

To determine the current user, Windows uses USERPROFILE, while Linux uses $USER. There are small differences in the directory structures, but they're all fairly close.


This free site is ad-supported. Learn more