Skip to content

Commit

Permalink
Fix fg.deobf trying source downloads on every project refresh (Minecr…
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt authored May 3, 2024
1 parent 1028625 commit c039769
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,22 @@ private File findRaw(Artifact artifact, String mapping) throws IOException {

@Nullable
private File findSource(Artifact artifact, String mapping) throws IOException {
// Check if we have previously failed to retrieve sources for the artifact.
// If so, don't attempt the download again.
File noSourceFlag = cache(getArtifactPath(artifact, mapping) + ".nosources");
if(noSourceFlag.exists()) return null;

File origFile = MavenArtifactDownloader.manual(project, artifact.getDescriptor(), false);
if (origFile == null) return null;
if (origFile == null) {
// Flag that downloading has failed so we don't repeat it
try {
noSourceFlag.getParentFile().mkdirs();
noSourceFlag.createNewFile();
} catch(IOException e) {
// Ignore it, not important
}
return null;
}

return deobfuscator.deobfSources(origFile, mapping, getArtifactPath(artifact, mapping));
}
Expand Down

0 comments on commit c039769

Please sign in to comment.