diff options
author | Steve Kondik <steve@cyngn.com> | 2016-09-06 01:16:05 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-09-06 01:16:05 -0700 |
commit | 0c04e1da60cf8af9e6681f48bf0b4b4b42a57d49 (patch) | |
tree | 729d103c48e9ccbb8e0671bd250f9c12e0e075b0 | |
parent | dd4956d3881a9a329e99d468ca605b7353f8ad00 (diff) | |
download | android_packages_apps_CMFileManager-0c04e1da60cf8af9e6681f48bf0b4b4b42a57d49.tar.gz android_packages_apps_CMFileManager-0c04e1da60cf8af9e6681f48bf0b4b4b42a57d49.tar.bz2 android_packages_apps_CMFileManager-0c04e1da60cf8af9e6681f48bf0b4b4b42a57d49.zip |
Fix mountpoint parsing
* Not all systems follow the assumed format. New kernels do not
include the "on" and "type" literals, and do not place
parenthesis around the mount options.
* Detect these conditions and do the right thing.
Change-Id: Ib88edf049e6a42cdab26274202f09de2bc19b493
-rw-r--r-- | src/com/cyanogenmod/filemanager/util/ParseHelper.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/cyanogenmod/filemanager/util/ParseHelper.java b/src/com/cyanogenmod/filemanager/util/ParseHelper.java index 7129af55..6b1fa4f2 100644 --- a/src/com/cyanogenmod/filemanager/util/ParseHelper.java +++ b/src/com/cyanogenmod/filemanager/util/ParseHelper.java @@ -311,20 +311,29 @@ public final class ParseHelper { line = line.substring(pos).trim(); // Skip "on" pos = line.indexOf(" "); //$NON-NLS-1$ - line = line.substring(pos).trim(); + if ("on".equals(line.substring(0, pos).trim())) { + line = line.substring(pos).trim(); + } // Mount point pos = line.indexOf(" "); //$NON-NLS-1$ String mountPoint = line.substring(0, pos).trim(); line = line.substring(pos).trim(); // Skip "type" pos = line.indexOf(" "); //$NON-NLS-1$ - line = line.substring(pos).trim(); + if ("type".equals(line.substring(0, pos).trim())) { + line = line.substring(pos).trim(); + } // Type pos = line.indexOf(" "); //$NON-NLS-1$ String type = line.substring(0, pos).trim(); line = line.substring(pos).trim(); // Options - String options = line.substring(1, line.length() - 1).trim(); + String options; + if (line.charAt(0) == '(') { + options = line.substring(1, line.length() - 1).trim(); + } else { + options = line.trim(); + } //Return the mount point return new MountPoint(mountPoint, device, type, options, /*dump*/0, /*pass*/0, false, false); |