Skip to content
This repository was archived by the owner on May 13, 2023. It is now read-only.

Commit

Permalink
Delete outdated symlinks in maven resolver cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolykt committed Jan 9, 2023
1 parent 4dd3d57 commit 7067441
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MIT License

Copyright (c) 2021 Cool Crabs
Copyright (c) 2022 Starloader-project
Copyright (c) 2022 - 2023 Starloader-project

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
Expand Down Expand Up @@ -191,6 +192,14 @@ private ResolvedFile resolveFileContents(@NotNull String folder, @NotNull String
if (Files.exists(nolookupFile)) {
return null;
}
if (Files.exists(cacheFile, LinkOption.NOFOLLOW_LINKS)) {
Logger.info("Deleting outdated symlink: " + cacheFile.toAbsolutePath());
try {
Files.delete(cacheFile);
} catch (IOException e) {
e.printStackTrace();
}
}
}
for (MavenRepository repo : repositories) {
ResolvedFile resolved = repo.resolve(folder, file);
Expand Down

0 comments on commit 7067441

Please sign in to comment.