"StorageVolumeInfo.storageVolumeInfo.getStorageVolumes()" lets app hang when network drive is not reachable
Using StorageVolumeInfo.storageVolumeInfo.getStorageVolumes() lets app hang when a network drive is not reachable.
It always takes around 20 seconds for the timeout to happen.
I would assume that the method is not "async" similar to several methods of the File class where specific async counterparts exist.
@ajwfrost: Can you confirm this? Is this working as intended and if so, would it be possible for you to implement an async method?
Enviroment: Windows 10, AIR 33.1.1.795

Any possibility you could check on this briefly?
Yes this is an issue with the Win32 function taking a long time, and we're just in some synchronous code.. https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumeinformationa
So we can look at adding a getStorageVolumesAsync() option, I guess we would also then need a new event that can be dispatched when it completes that would contain the list of StorageVolume objects; or we could dispatch multiple StorageVolumeChangeEvent objects as/when each volume has been identified (with a new event type as well as the mount/unmount ones, e.g. storageVolumeDiscovered..?)
Either that, or we add a property to the StorageVolumeInfo class that is just the list of latest known volumes, which is null until getStorageVolumes() or getStoreVolumesAsync() is called, and is then populated by those functions (synchronously in the existing API, and asynchronously in the new API, and we just dispatch a complete event when the async version has finished..)?
Different options for this one, please let me know what sort of approach you think makes more sense!
thanks
Thanks for getting back on this!
We would prefer the complete event for the async approach :)
So if we added a currentVolumes property and a new API, we could support a flow like:
// add event listener for when we get the volumes
StorageVolumeInfo.storageVolumeInfo.addEventListener(Event.COMPLETE, function(e:Event):void {
// get the latest volumes
var volumes:Vector.<StorageVolume> = StorageVolumeInfo.storageVolumeInfo.currentVolumes;
for (var i:int = 0; i < volumes.length; i++)
{
var volume:StorageVolume = volumes[i];
trace("nativePath:", volume.rootDirectory.nativePath);
trace("fileSystemType:", volume.fileSystemType);
trace("isRemovable:", volume.isRemovable);
trace("isWritable:", volume.isWritable);
trace("drive:", volume.drive);
trace("name:", volume.name);
}
});
// request the volumes asynchronously
StorageVolumeInfo.storageVolumeInfo.getStorageVolumesAsync();
This would be perfect :) thanks for the consideration!
@ajwfrost Is there any update on this feature?
Hi @2jfw .. I've just been looking for this. Our internal tracker shows that this was done, and our AS3 documentation also shows it as completed: https://airsdk.dev/reference/actionscript/3.0/flash/filesystem/StorageVolumeInfo.html#getStorageVolumesAsync()
But I don't see any mention of it in https://airsdk.harman.com/release_notes !
So, looking at the code, there is an implementation of this which should be platform-generic, using a background thread within the StorageVolumeInfo glue code to populate the currentVolumes list when it dispatches the complete event.
In other words -> I think this is implemented, but I'm afraid we somehow missed it off the release notes!
Please have a try...!
thanks
@ajwfrost Sounds good :) I can see in the IDE, that the StorageVolumeInfo has that function. I will try it out and report back - many thanks 👍
Reporting back, that it is working as expected. Many thanks again!
Okay great! thanks for confirming. I will see whether we can retrospectively inject a new release note for 50.0 into the database so that it at least appears on the release_notes page!