Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed Sep 29, 2024
1 parent 49a5c57 commit e7ff850
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,21 @@ public void install() throws IOException {
String newFilename;
try (BufferedReader reader = Files.newBufferedReader(dest)) {
newFilename = new GsonBuilder().create().fromJson(reader, JsonDependency.class).fileName;
if (newFilename == null) {
getLogger().warn("Couldn't find fileName field in " + destString + "\n Aborting");
return;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
File file = new File(destString);
int lastPathSeperator = dest.toString().lastIndexOf('/');
boolean didRename = file.renameTo(new File(dest.toString().substring(0, lastPathSeperator + 1) + newFilename));
if (didRename == true) {
getLogger().info("File Succesfully Renamed");
int lastPathSeparator = dest.toString().lastIndexOf('/');
File newFile = new File(dest.toString().substring(0, lastPathSeparator + 1) + newFilename);
boolean didRename = file.renameTo(newFile);
if (didRename) {
getLogger().info("Succesfully renamed " + file.toString() + " to " + newFile.toString());
} else {
getLogger().warn("Failed to rename file");
getLogger().warn("Failed to rename file " + file.toString() + " to " + newFile.toString());
}
}

Expand Down

0 comments on commit e7ff850

Please sign in to comment.