From 0c04e1da60cf8af9e6681f48bf0b4b4b42a57d49 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Tue, 6 Sep 2016 01:16:05 -0700 Subject: 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 --- src/com/cyanogenmod/filemanager/util/ParseHelper.java | 15 ++++++++++++--- 1 file 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); -- cgit v1.2.3