Francois
Francois

Reputation: 93

Get any usb disk info with Adobe AIR

I've been struggeling with that for a few days so I come and post here.

I have an air application running from an USB drive. I simply want to be able to detect if the files have been moved on a new USB disk.

Is there any way to get any information on the disk like :

The only thing I have acces is the name of the disk but two disks can easily have the same name.

I tried as well to use the "downloaded from Internet" Flag but it does'nt seem to be working.

Thank you so much if you can help me.

MrKalten

Upvotes: 1

Views: 1237

Answers (2)

Pratik Velani
Pratik Velani

Reputation: 37

Post Adobe AIR 2.0, they have introduced a new apis to handle StorageVolumes You can get the reference and example here. http://help.adobe.com/en_US/air/reference/html/flash/filesystem/StorageVolumeInfo.html

Use this method to get all the storage volumes connected external/internal.

import flash.filesystem.StorageVolume;
import flash.filesystem.StorageVolumeInfo;

var volumes = StorageVolumeInfo.storageVolumeInfo.getStorageVolumes(); 
for (var i = 0; i < volumes.length; i++) 
{ 
    var volume:StorageVolume = volumes[i];
    trace ("Name ::" + volume.name);
    trace ("Path ::" + volume.rootDirectory.nativePath); 
    trace ("isRemovable ::" + volume.isRemovable);
}

Upvotes: 3

lostPixels
lostPixels

Reputation: 1343

This may be another way to expose that information to AIR: http://www.mikechambers.com/blog/2008/01/17/commandproxy-net-air-integration-proof-of-concept/

Upvotes: 0

Related Questions