Skip to content

Commit 18984aa

Browse files
committed
fix output path bug
1 parent ab0ab06 commit 18984aa

File tree

6 files changed

+41
-5
lines changed

6 files changed

+41
-5
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ build/
4040
.cursor/
4141

4242
/release-
43-
release-1.0.0/
43+
release-*/

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.1] - 2024-05-30
9+
10+
### 🐛 Bug Fixes
11+
- **Configurable Output Directory**: Fixed hardcoded output directory issue
12+
- Added `--output-dir` CLI option to specify custom output directory
13+
- Default output directory is now `<project>/AAA` instead of hardcoded path
14+
- Output directory is automatically created if it doesn't exist
15+
16+
### ✨ Improvements
17+
- **Enhanced CLI Interface**: Better user control over output location
18+
- **Cross-platform Compatibility**: Removed system-specific hardcoded paths
19+
820
## [1.0.0] - 2024-05-30
921

1022
### 🎉 Initial Release

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ application {
1717
}
1818

1919
group = 'edu.stevens'
20-
version = '1.0.0'
20+
version = '1.0.1'
2121

2222
dependencies {
2323
// Use JitPack dependency for release builds

src/main/java/edu/stevens/swe/research/java/cli/Main.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public class Main implements Callable<Integer> {
4040
@Option(names = {"--output-file"}, description = "Path to the output file.")
4141
private File outputFile;
4242

43+
@Option(names = {"--output-dir"}, description = "Directory for task output files. Default: <project>/AAA")
44+
private File outputDir;
45+
4346
@Option(names = {"--plugin-path"}, description = "Path to the directory containing plugin JARs.")
4447
private File pluginPath;
4548

@@ -69,8 +72,16 @@ public Integer call() throws Exception {
6972
// (e.g., if plugins are not on the main classpath)
7073
}
7174

75+
// Set default output directory if not specified
76+
if (outputDir == null) {
77+
outputDir = new File(projectDir, "AAA");
78+
}
79+
System.out.println("Output Directory: " + outputDir.getAbsolutePath());
80+
7281
// 1. Create ProjectCtx
7382
ProjectCtx projectCtx = new ProjectCtx(projectDir.toPath(), language);
83+
// Set the output directory in ProjectCtx
84+
projectCtx.setOutputDirectory(outputDir.toPath());
7485
// TODO: Populate ProjectCtx further from configFile if provided
7586
// For example, load source roots, classpath, specific task configs etc.
7687

src/main/java/edu/stevens/swe/research/java/cli/analyzer/ProjectCtx.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class ProjectCtx {
1515
private List<Path> classpath;
1616
private Path jdkPath; // Optional, might be inferred or configured
1717
private Path tempDir;
18+
private Path outputDirectory; // Directory for task output files
1819

1920
public ProjectCtx(Path projectPath, String language) {
2021
this.projectPath = projectPath;
@@ -75,5 +76,13 @@ public void setTempDir(Path tempDir) {
7576
this.tempDir = tempDir;
7677
}
7778

79+
public Path getOutputDirectory() {
80+
return outputDirectory;
81+
}
82+
83+
public void setOutputDirectory(Path outputDirectory) {
84+
this.outputDirectory = outputDirectory;
85+
}
86+
7887
// TODO: Add methods to help resolve files or paths within the project context
7988
}

src/main/java/edu/stevens/swe/research/java/cli/analyzer/tasks/ParseTestCaseToLlmContextTask.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ public TaskResult execute(ProjectCtx projectCtx) {
4545
List<String> processedFiles = new ArrayList<>();
4646
int testCasesFound = 0;
4747

48-
// Define output directory for JSON files - TEMPORARILY HARDCODED FOR TESTING
49-
Path outputDir = Paths.get("/Users/chenhaowei/Documents/research-related-data/commons-cli/results");
50-
System.out.println("[TESTING] Using hardcoded output directory: " + outputDir);
48+
// Get output directory from ProjectCtx
49+
Path outputDir = projectCtx.getOutputDirectory();
50+
if (outputDir == null) {
51+
// Fallback to default if not set (should not happen with current implementation)
52+
outputDir = projectCtx.getProjectPath().resolve("AAA");
53+
}
54+
System.out.println("Using output directory: " + outputDir);
5155

5256
try {
5357
Files.createDirectories(outputDir);

0 commit comments

Comments
 (0)