diff options
Diffstat (limited to 'sched')
-rw-r--r-- | sched/src/com/android/sched/vfs/CaseInsensitiveFS.java | 4 | ||||
-rw-r--r-- | sched/src/com/android/sched/vfs/VPath.java | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java b/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java index eedde0d..9a40130 100644 --- a/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java +++ b/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java @@ -188,10 +188,10 @@ public class CaseInsensitiveFS extends BaseVFS<CaseInsensitiveVDir, CaseInsensit char type = line.charAt(0); switch (type) { case 'd': - root.createVDir(new VPath(line.substring(3), '/')); + root.createVDir(new VPath(line.substring(2), '/')); break; case 'f': - root.createVFile(new VPath(line.substring(3), '/')); + root.createVFile(new VPath(line.substring(2), '/')); break; default: throw new WrongVFSFormatException(this, vfs.getLocation(), diff --git a/sched/src/com/android/sched/vfs/VPath.java b/sched/src/com/android/sched/vfs/VPath.java index b0acd5f..a3d1501 100644 --- a/sched/src/com/android/sched/vfs/VPath.java +++ b/sched/src/com/android/sched/vfs/VPath.java @@ -66,6 +66,7 @@ public final class VPath implements Cloneable { * @return the current path */ public VPath prependPath(@Nonnull VPath path) { + assert !this.equals(VPath.ROOT); pathFragments.add(0, new VPathFragment(String.valueOf(INTERNAL_SEPARATOR), INTERNAL_SEPARATOR)); pathFragments.addAll(0, path.getPathFragments()); @@ -79,7 +80,9 @@ public final class VPath implements Cloneable { * @return the current path */ public VPath appendPath(@Nonnull VPath path) { - pathFragments.add(new VPathFragment(String.valueOf(INTERNAL_SEPARATOR), INTERNAL_SEPARATOR)); + if (!this.equals(VPath.ROOT)) { + pathFragments.add(new VPathFragment(String.valueOf(INTERNAL_SEPARATOR), INTERNAL_SEPARATOR)); + } pathFragments.addAll(path.getPathFragments()); return this; @@ -189,10 +192,9 @@ public final class VPath implements Cloneable { if (toString.contains(doubleSeparator)) { throw new AssertionError("Path: " + toString); } - //XXX: prepend and append generate invalid paths -// if (toString.startsWith(stringSeparator)) { -// throw new AssertionError("Path: " + toString); -// } + if (toString.startsWith(stringSeparator)) { + throw new AssertionError("Path: " + toString); + } if (toString.endsWith(stringSeparator)) { throw new AssertionError("Path: " + toString); } |