MCPcopy Create free account
hub / github.com/buggins/coolreader / autoAddRoots

Method autoAddRoots

android/src/org/coolreader/crengine/Engine.java:940–974  ·  view source on GitHub ↗
(Map<String, String> list, String rootPath, String[] pathsToExclude)

Source from the content-addressed store, hash-verified

938
939 private static final String[] SYSTEM_ROOT_PATHS = {"/system", "/data", "/mnt"};
940 private void autoAddRoots(Map<String, String> list, String rootPath, String[] pathsToExclude)
941 {
942 try {
943 File root = new File(rootPath);
944 File[] files = root.listFiles();
945 if ( files!=null ) {
946 for ( File f : files ) {
947 if ( !f.isDirectory() )
948 continue;
949 String fullPath = f.getAbsolutePath();
950 if ( isLink(fullPath) ) {
951 L.d("skipping symlink " + fullPath);
952 continue;
953 }
954 boolean skip = false;
955 for ( String path : pathsToExclude ) {
956 if ( fullPath.startsWith(path) ) {
957 skip = true;
958 break;
959 }
960 }
961 if ( skip )
962 continue;
963 if ( !f.canWrite() ) {
964 L.i("Path is readonly: " + f.getAbsolutePath());
965 continue;
966 }
967 L.i("Found possible mount point " + f.getAbsolutePath());
968 addMountRoot(list, f.getAbsolutePath(), f.getAbsolutePath());
969 }
970 }
971 } catch ( Exception e ) {
972 L.w("Exception while trying to auto add roots");
973 }
974 }
975
976 private void initMountRoots() {
977 Map<String, String> map = new LinkedHashMap<String, String>();

Callers 1

initMountRootsMethod · 0.95

Calls 6

isLinkMethod · 0.95
dMethod · 0.95
iMethod · 0.95
addMountRootMethod · 0.95
wMethod · 0.95
startsWithMethod · 0.80

Tested by

no test coverage detected