Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void launchReport() {
- double date = 0;
- File latest = null;
- File folder = new File("public/reports");
- File[] listOfFiles = folder.listFiles();
- for (int i = 0; i < listOfFiles.length; i++) {
- if (listOfFiles[i].isFile()) {
- if (date < listOfFiles[i].lastModified()) {
- date = listOfFiles[i].lastModified();
- latest = listOfFiles[i];
- }
- }
- }
- File htmlFile = new File(latest.getAbsolutePath());
- try {
- String content = new String ( Files.readAllBytes( Paths.get(latest.getAbsolutePath()) ) );
- System.out.println(content);
- content = content.replaceAll("<span class=\"test-status right pass\">pass</span>", "<span class=\"test-status right pass\">Complete</span>");
- PrintWriter out = new PrintWriter(latest.getAbsoluteFile());
- out.print(content);
- out.close();
- Desktop.getDesktop().browse(htmlFile.toURI());
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement