src/share/classes/org/openjdk/jigsaw/ModuleFile.java
Print this page
*** 507,536 ****
filesWriter.println(Files.convertSeparator(relativize(destination, file)));
filesWriter.flush();
}
! void remove() throws IOException {
! ModuleFile.Reader.remove(destination);
}
// Removes a module, given its module install directory
! static void remove(File moduleDir) throws IOException {
// Firstly remove any files installed outside of the module dir
File files = new File(moduleDir, "files");
if (files.exists()) {
try (FileInputStream fis = new FileInputStream(files);
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
BufferedReader in = new BufferedReader(isr)) {
String filename;
! while ((filename = in.readLine()) != null)
! Files.delete(new File(moduleDir,
! Files.platformSeparator(filename)));
}
}
! Files.deleteTree(moduleDir);
}
// Returns the absolute path of the given section type.
private File getDirOfSection(SectionType type) {
if (type == SectionType.NATIVE_LIBS)
--- 507,543 ----
filesWriter.println(Files.convertSeparator(relativize(destination, file)));
filesWriter.flush();
}
! List<IOException> remove() {
! return ModuleFile.Reader.remove(destination);
}
// Removes a module, given its module install directory
! static List<IOException> remove(File moduleDir) {
! List<IOException> excs = new ArrayList<>();
// Firstly remove any files installed outside of the module dir
File files = new File(moduleDir, "files");
if (files.exists()) {
try (FileInputStream fis = new FileInputStream(files);
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
BufferedReader in = new BufferedReader(isr)) {
String filename;
! while ((filename = in.readLine()) != null) {
! IOException x = Files.deleteUnchecked(new File(moduleDir,
! Files.platformSeparator(filename)).toPath());
! if (x != null)
! excs.add(x);
}
+ } catch (IOException x) {
+ excs.add(x);
}
+ }
! excs.addAll(Files.deleteAllUnchecked(moduleDir.toPath()));
! return excs;
}
// Returns the absolute path of the given section type.
private File getDirOfSection(SectionType type) {
if (type == SectionType.NATIVE_LIBS)