mercredi 16 novembre 2016

Accessing attached drives to display in FileSystemTree?

I need to make a cross-platorm (PC, OSX) "Windows Explorer" type file system browser utility in AIR. It's all pretty straightforward with FileSystemTree and the other file system components but I am stuck on presenting the user with a dropdown menu to select attached drives.

Anyone have some boilerplate code or clarity for doing this? I've been digging around with StorageVolumeInfo but it is not being very clear (or I very tired). In the output below, I am only interested in "THUMB_DRIVE" and "Storage" – as those are the two external drives connected.

Question: Given an unknown user situation where they could have any number of external drives connected, how do I differentiate the drives I want from the virtual or network drives?

fileSystemType msdos
rootDirectory file:///Volumes/THUMB_DRIVE

fileSystemType hfs
name Storage
rootDirectory file:///Volumes/Storage

fileSystemType autofs
name net rootDirectory file:///net

fileSystemType autofs
name home rootDirectory

fileSystemType mtmfs
name MobileBackups
rootDirectory file:///Volumes/MobileBackups

fileSystemType hfs
name Dazzle
rootDirectory file:///

 volumes = StorageVolumeInfo.storageVolumeInfo.getStorageVolumes();

 for (var i:int = 0; i < volumes.length; i++) {
     trace("fileSystemType", volumes[i].fileSystemType);
     trace("name", volumes[i].name);
     trace("rootDirectory", volumes[i].rootDirectory.url);

Aucun commentaire:

Enregistrer un commentaire