| 584 | } |
| 585 | |
| 586 | private void autoAddRoots( String rootPath, String[] pathsToExclude ) |
| 587 | { |
| 588 | try { |
| 589 | File root = new File(rootPath); |
| 590 | File[] files = root.listFiles(); |
| 591 | if ( files!=null ) { |
| 592 | for ( File f : files ) { |
| 593 | if ( !f.isDirectory() ) |
| 594 | continue; |
| 595 | String fullPath = f.getAbsolutePath(); |
| 596 | if ( engine.isLink(fullPath) ) { |
| 597 | L.d("skipping symlink " + fullPath); |
| 598 | continue; |
| 599 | } |
| 600 | boolean skip = false; |
| 601 | for ( String path : pathsToExclude ) { |
| 602 | if ( fullPath.startsWith(path) ) { |
| 603 | skip = true; |
| 604 | break; |
| 605 | } |
| 606 | } |
| 607 | if ( skip ) |
| 608 | continue; |
| 609 | if ( !f.canWrite() ) |
| 610 | continue; |
| 611 | L.i("Found possible mount point " + f.getAbsolutePath()); |
| 612 | addRoot(f.getAbsolutePath(), f.getAbsolutePath(), true); |
| 613 | } |
| 614 | } |
| 615 | } catch ( Exception e ) { |
| 616 | L.w("Exception while trying to auto add roots"); |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | public static final String[] SD_MOUNT_POINTS = { |
| 621 | "/system/media/sdcard", |