File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ export default {
37
37
getClassPackage ( context ) {
38
38
const projectPath = module . exports . getProjectPath ( context ) ;
39
39
const projectRemoved = ( context . filepath . replace ( `${ projectPath } /` , '' ) ) ;
40
- return projectRemoved . replace ( `/${ context . filename } ` , '' ) ;
40
+ const filenameRemoved = projectRemoved . replace ( `/${ context . filename } ` , '' ) ;
41
+
42
+ // File is in root of src directory - no package
43
+ if ( filenameRemoved == projectRemoved ) {
44
+ return "" ;
45
+ }
46
+
47
+ return filenameRemoved + "."
41
48
} ,
42
49
} ;
Original file line number Diff line number Diff line change @@ -342,12 +342,15 @@ module.exports =
342
342
" File Based" :
343
343
command : if GrammarUtils .OperatingSystem .isWindows () then " cmd" else " bash"
344
344
args : (context ) ->
345
- className = context .filename .replace / \. java$ / , " "
345
+ className = GrammarUtils .Java .getClassName context
346
+ classPackages = GrammarUtils .Java .getClassPackage context
347
+
346
348
args = []
347
349
if GrammarUtils .OperatingSystem .isWindows ()
348
350
args = [" /c javac -Xlint #{ context .filename } && java #{ className} " ]
349
351
else
350
- args = [' -c' , " javac -d /tmp '#{ context .filepath } ' && java -cp /tmp #{ className} " ]
352
+ args = [' -c' , " javac -d /tmp '#{ context .filepath } ' && java -cp /tmp #{ classPackages}#{ className} " ]
353
+
351
354
return args
352
355
353
356
JavaScript :
You can’t perform that action at this time.
0 commit comments