Main Site Documentation

SD Card GetStorageDevice().ListDirectories() Exception


#1

I think I know the answer already but I had to ask about using something like…



 sdCard.MountSDCard();

 string rootDirectory = sdCard.GetStorageDevice().RootDirectory;

 string[] dir = sdCard.GetStorageDevice().ListDirectories(rootDirectory);

 //#### Exception System.IO.IOException - CLR_E_DIRECTORY_NOT_FOUND (1) ####


The exception is thrown if no directories exist.

I can try { } and catch { } the exception and then know that no directories exist but I’m looking for a ‘cleaner’ way.

Is there?