Skip to content

Commit

Permalink
util/FindDirectoryStructure: Add additional SDCard mount point for Linux
Browse files Browse the repository at this point in the history
Some Linux flavours use /media/username or /run/media/username as mount point instead of /media. Check if it is the case and add them.

Fix getodk#73
  • Loading branch information
shivam-tripathi committed Mar 23, 2017
1 parent 8282259 commit d8cb04d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/org/opendatakit/briefcase/util/FindDirectoryStructure.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class FindDirectoryStructure {
private static final String PROPERTY_OS = "os.name";
private static final String OS_WINDOWS = "Windows";
private static final String OS_MAC = "Mac";
private static final String USER_NAME = "user.name";

public static boolean isMac() {
String os = System.getProperty(PROPERTY_OS);
Expand All @@ -59,8 +60,21 @@ public static List<File> searchMountedDrives() {
return search(mounts, false);
} else // Assume Unix
{
File[] mounts = { new File("/mnt"), new File("/media") };
return search(mounts, false);
String username = System.getProperty(USER_NAME);
List<File> mountslist = new ArrayList<File>();
mountslist.add( new File("/mnt"));
mountslist.add( new File("/media"));

File f = new File("/media",username);
if (f.exists() && f.isDirectory()) {
mountslist.add(f);
}

f = new File("/run/media", username);
if (f.exists() && f.isDirectory()){
mountslist.add(f);
}
return search(mountslist.toArray(new File[mountslist.size()]), false);
}
}

Expand Down

0 comments on commit d8cb04d

Please sign in to comment.