Skip to content

Commit

Permalink
Add TemporaryDirectory#file convenience method
Browse files Browse the repository at this point in the history
  • Loading branch information
dabico committed Jul 12, 2024
1 parent 4dae390 commit 486ed84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/java/ch/usi/si/seart/io/TemporaryDirectory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.springframework.util.FileSystemUtils;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -12,6 +13,10 @@ public TemporaryDirectory(String prefix) throws IOException {
this(Files.createTempDirectory(prefix));
}

public File file() {
return path.toFile();
}

@Override
public void close() throws IOException {
FileSystemUtils.deleteRecursively(path);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/usi/si/seart/job/CodeAnalysisJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void gatherCodeMetricsFor(@NotNull GitRepo gitRepo) {
TemporaryDirectory temporaryDirectory = temporaryDirectoryFactory.getObject();
Git ignored = cloneCommandFactory.getObject()
.setURI(uri)
.setDirectory(temporaryDirectory.path().toFile())
.setDirectory(temporaryDirectory.file())
.setDepth(1)
.call()
) {
Expand Down

0 comments on commit 486ed84

Please sign in to comment.