ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Contains helper methods to get list of available media. More...

Collaboration diagram for org::residualvm::residualvm::ExternalStorage:

List of all members.

Static Public Member Functions

static LinkedHashSet< File > findSdCardPath ()
 Find path to removable SD card.
static boolean isAvailable ()
static String getSdCardPath ()
static boolean isWritable ()
static List< String > getAllStorageLocations ()

Static Public Attributes

static final String SD_CARD = "sdCard"
static final String EXTERNAL_SD_CARD = "externalSdCard"
static final String DATA_DIRECTORY = "ResidualVM data directory"

Static Private Member Functions

static String ancestor (File dir)
static void addStrings (String[] newPaths, LinkedHashSet< File > candidatePaths)
 Add each path to the collection.
static void addAncestors (File[] files, LinkedHashSet< File > candidatePaths)
 Add ancestor of each File to the collection.
static void addPath (String strNew, Collection< File > paths)
 Add a new candidate directory path to our list, if it's not obviously wrong.

Static Private Attributes

static final String ANDROID_DIR = "Android"
static Pattern devicePattern = Pattern.compile("/dev/(block/.*vold.*|fuse)|/mnt/.*")
 Pattern that SD card device should match.
static Pattern pathPattern = Pattern.compile("/(mnt|storage|external_sd|extsd|_ExternalSD|Removable|.*MicroSD).*", Pattern.CASE_INSENSITIVE)
 Pattern that SD card mount path should match.
static Pattern pathAntiPattern = Pattern.compile(".*(/secure|/asec|/emulated).*")
 Pattern that the mount path should not match.
static Pattern fsTypePattern = Pattern.compile(".*(fat|msdos|ntfs|ext[34]|fuse|sdcard|esdfs).*")
 These are expected fs types, including vfat.
static String[] commonPaths
 Common paths for microSD card.

Detailed Description

Contains helper methods to get list of available media.

Definition at line 25 of file ExternalStorage.java.


Member Function Documentation

static void org::residualvm::residualvm::ExternalStorage::addAncestors ( File[]  files,
LinkedHashSet< File >  candidatePaths 
) [inline, static, private]

Add ancestor of each File to the collection.

Definition at line 297 of file ExternalStorage.java.

static void org::residualvm::residualvm::ExternalStorage::addPath ( String  strNew,
Collection< File >  paths 
) [inline, static, private]

Add a new candidate directory path to our list, if it's not obviously wrong.

Supply path as either String or File object.

Parameters:
strNew path of directory to add

Definition at line 308 of file ExternalStorage.java.

static void org::residualvm::residualvm::ExternalStorage::addStrings ( String[]  newPaths,
LinkedHashSet< File >  candidatePaths 
) [inline, static, private]

Add each path to the collection.

Definition at line 290 of file ExternalStorage.java.

static String org::residualvm::residualvm::ExternalStorage::ancestor ( File  dir  )  [inline, static, private]

Definition at line 35 of file ExternalStorage.java.

static LinkedHashSet<File> org::residualvm::residualvm::ExternalStorage::findSdCardPath (  )  [inline, static]

Find path to removable SD card.

Possible SD card paths

Build a list of candidate paths, roughly in order of preference. That way if we can't definitively detect removable storage, we at least can pick a more likely candidate.

Definition at line 116 of file ExternalStorage.java.

static List<String> org::residualvm::residualvm::ExternalStorage::getAllStorageLocations (  )  [inline, static]
Returns:
list of locations available. Odd elements are names, even are paths

Definition at line 362 of file ExternalStorage.java.

static String org::residualvm::residualvm::ExternalStorage::getSdCardPath (  )  [inline, static]

Definition at line 343 of file ExternalStorage.java.

static boolean org::residualvm::residualvm::ExternalStorage::isAvailable (  )  [inline, static]
Returns:
True if the external storage is available. False otherwise.

Definition at line 335 of file ExternalStorage.java.

static boolean org::residualvm::residualvm::ExternalStorage::isWritable (  )  [inline, static]
Returns:
True if the external storage is writable. False otherwise.

Definition at line 350 of file ExternalStorage.java.


Member Data Documentation

final String org::residualvm::residualvm::ExternalStorage::ANDROID_DIR = "Android" [static, private]

Definition at line 33 of file ExternalStorage.java.

Common paths for microSD card.

Definition at line 67 of file ExternalStorage.java.

final String org::residualvm::residualvm::ExternalStorage::DATA_DIRECTORY = "ResidualVM data directory" [static]

Definition at line 28 of file ExternalStorage.java.

Pattern org::residualvm::residualvm::ExternalStorage::devicePattern = Pattern.compile("/dev/(block/.*vold.*|fuse)|/mnt/.*") [static, private]

Pattern that SD card device should match.

Definition at line 55 of file ExternalStorage.java.

final String org::residualvm::residualvm::ExternalStorage::EXTERNAL_SD_CARD = "externalSdCard" [static]

Definition at line 27 of file ExternalStorage.java.

Pattern org::residualvm::residualvm::ExternalStorage::fsTypePattern = Pattern.compile(".*(fat|msdos|ntfs|ext[34]|fuse|sdcard|esdfs).*") [static, private]

These are expected fs types, including vfat.

tmpfs is not OK. fuse can be removable SD card (as on Moto E or Asus ZenPad), or can be internal (Huawei G610).

Definition at line 64 of file ExternalStorage.java.

Pattern org::residualvm::residualvm::ExternalStorage::pathAntiPattern = Pattern.compile(".*(/secure|/asec|/emulated).*") [static, private]

Pattern that the mount path should not match.

'emulated' indicates an internal storage location, so skip it. 'asec' is an encrypted package file, decrypted and mounted as a directory.

Definition at line 61 of file ExternalStorage.java.

Pattern org::residualvm::residualvm::ExternalStorage::pathPattern = Pattern.compile("/(mnt|storage|external_sd|extsd|_ExternalSD|Removable|.*MicroSD).*", Pattern.CASE_INSENSITIVE) [static, private]

Pattern that SD card mount path should match.

Definition at line 57 of file ExternalStorage.java.

Definition at line 26 of file ExternalStorage.java.


The documentation for this class was generated from the following file:


Generated on Sat Sep 26 2020 05:03:49 for ResidualVM by doxygen 1.7.1
curved edge   curved edge