mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Unit tests for the removable drive plugin.
This commit is contained in:
@@ -91,7 +91,6 @@ abstract class FilePlugin implements BatchTransportPlugin {
|
||||
OutputStream out = new FileOutputStream(f);
|
||||
return new FileTransportWriter(f, out, capacity, this);
|
||||
} catch(IOException e) {
|
||||
e.printStackTrace();
|
||||
f.delete();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,24 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.sf.briar.api.TransportId;
|
||||
|
||||
class RemovableDrivePlugin extends FilePlugin {
|
||||
|
||||
public static final int TRANSPORT_ID = 0;
|
||||
|
||||
private static final TransportId id = new TransportId(TRANSPORT_ID);
|
||||
|
||||
private final RemovableDriveFinder finder;
|
||||
|
||||
RemovableDrivePlugin(RemovableDriveFinder finder) {
|
||||
this.finder = finder;
|
||||
}
|
||||
|
||||
public TransportId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File chooseOutputDirectory() {
|
||||
try {
|
||||
@@ -19,7 +29,7 @@ class RemovableDrivePlugin extends FilePlugin {
|
||||
if(drives.isEmpty()) return null;
|
||||
String[] paths = new String[drives.size()];
|
||||
for(int i = 0; i < paths.length; i++) {
|
||||
paths[i] = drives.get(i).getAbsolutePath();
|
||||
paths[i] = drives.get(i).getPath();
|
||||
}
|
||||
int i = callback.showChoice("REMOVABLE_DRIVE_CHOOSE_DRIVE", paths);
|
||||
if(i == -1) return null;
|
||||
|
||||
@@ -9,9 +9,7 @@ import java.util.Scanner;
|
||||
abstract class UnixRemovableDriveFinder implements RemovableDriveFinder {
|
||||
|
||||
protected abstract String getMountCommand();
|
||||
|
||||
protected abstract String parseMountPoint(String line);
|
||||
|
||||
protected abstract boolean isRemovableDriveMountPoint(String path);
|
||||
|
||||
public List<File> findRemovableDrives() throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user