MCPcopy Create free account
hub / github.com/facebook/SoLoader / dumbDelete

Method dumbDelete

java/com/facebook/soloader/SysUtil.java:129–152  ·  view source on GitHub ↗

Delete a directory and its contents. WARNING: Java APIs do not let us distinguish directories from symbolic links to directories. Consequently, if the directory contains symbolic links to directories, we will attempt to delete the contents of pointed-to directories. @param file File or director

(File file)

Source from the content-addressed store, hash-verified

127 * @throws IOException IOException
128 */
129 public static void dumbDelete(File file) throws IOException {
130 Stack<File> filesStack = new Stack<>();
131 filesStack.push(file);
132 ArrayList<File> dirsToDelete = new ArrayList<>();
133 while (!filesStack.isEmpty()) {
134 File currentFile = filesStack.pop();
135 if (!currentFile.isDirectory()) {
136 deleteOrThrow(currentFile);
137 continue;
138 }
139 dirsToDelete.add(currentFile);
140 File[] fileList = currentFile.listFiles();
141 if (fileList == null) {
142 continue;
143 }
144 for (File entry : fileList) {
145 filesStack.push(entry);
146 }
147 }
148
149 for (int i = dirsToDelete.size() - 1; i >= 0; --i) {
150 deleteOrThrow(dirsToDelete.get(i));
151 }
152 }
153
154 /**
155 * Encapsulate Lollipop-specific calls into an independent class so we don't fail preverification

Callers 2

deleteSoFilesMethod · 0.95
extractDsoMethod · 0.95

Calls 3

deleteOrThrowMethod · 0.95
sizeMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected