Search in sources :

Example 6 with NoExternalStorageException

use of org.thoughtcrime.securesms.database.NoExternalStorageException in project Signal-Android by signalapp.

the class StorageUtil method getOrCreateBackupDirectory.

public static File getOrCreateBackupDirectory() throws NoExternalStorageException {
    File storage = Environment.getExternalStorageDirectory();
    if (!storage.canWrite()) {
        throw new NoExternalStorageException();
    }
    File backups = getBackupDirectory();
    if (!backups.exists()) {
        if (!backups.mkdirs()) {
            throw new NoExternalStorageException("Unable to create backup directory...");
        }
    }
    return backups;
}
Also used : NoExternalStorageException(org.thoughtcrime.securesms.database.NoExternalStorageException) File(java.io.File)

Aggregations

NoExternalStorageException (org.thoughtcrime.securesms.database.NoExternalStorageException)6 File (java.io.File)4 Uri (android.net.Uri)2