Skip to content

Commit

Permalink
fix: java run command
Browse files Browse the repository at this point in the history
  • Loading branch information
nedpals committed Feb 4, 2024
1 parent 4fdd45f commit 7f11f72
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/helpers/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var defaultRunCommands = map[string]RunCommand{
"python": {Universal: "python3 ${file}"},
"c": {Universal: "gcc ${file} -o ${fileNoExt} && ./${fileNoExt}"},
"cpp": {Universal: "g++ ${file} -o ${fileNoExt} && ./${fileNoExt}"},
"java": {Universal: "javac ${file} && java ${fileNoExt}"},
"java": {Universal: "javac ${filename} && java ${filenameNoExt}"},
"rust": {Universal: "rustc ${file} && ./${fileNoExt}"},
"go": {Universal: "go run ${file}"},
"js": {Universal: "node ${file}"},
Expand Down Expand Up @@ -125,6 +125,7 @@ func GetRunCommand(languageId string, filePath string) (string, error) {
r := strings.NewReplacer(
"${file}", filePath,
"${filename}", filepath.Base(filePath),
"${filenameNoExt}", strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filePath)),
"${dir}", filepath.Dir(filePath),
"${fileNoExt}", strings.TrimSuffix(filePath, filepath.Ext(filePath)),
)
Expand Down

0 comments on commit 7f11f72

Please sign in to comment.