Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #32 from m4tty/fix31
Browse files Browse the repository at this point in the history
fixes #31. send all java files in the project to javac, so it has the…
  • Loading branch information
keplersj committed Nov 4, 2015
2 parents 0fbef70 + a19a33d commit 3c70073
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions lib/init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports =
lint: (textEditor) =>
filePath = textEditor.getPath()
wd = path.dirname filePath

files = @getFilesEndingWith(@getProjectRootDir(), ".java")
# Classpath
cp = null

Expand All @@ -56,7 +56,7 @@ module.exports =
# Arguments to javac
args = ['-Xlint:all']
args = args.concat(['-cp', cp]) if cp?
args.push filePath
args.push.apply(args, files)

# Execute javac
helpers.exec(@javaExecutablePath, args, {stream: 'stderr', cwd: wd})
Expand Down Expand Up @@ -86,6 +86,27 @@ module.exports =
messages[messages.length - 1].range[1][1] = column + 1
return messages

getProjectRootDir: ->
return atom.project.rootDirectories[0].path

getFilesEndingWith: (startPath, endsWith) ->
foundFiles = []
if !fs.existsSync(startPath)
return foundFiles
files = fs.readdirSync(startPath)
i = 0
while i < files.length
filename = path.join(startPath, files[i])
stat = fs.lstatSync(filename)
if stat.isDirectory()
foundFiles.push.apply(foundFiles, @getFilesEndingWith(filename, endsWith))
else if filename.indexOf(endsWith, filename.length - (endsWith.length)) >= 0
foundFiles.push.apply(foundFiles, [filename])
#Array::push.apply foundFiles, filename
i++
return foundFiles


findClasspathConfig: (d) ->
# Search for the .classpath file starting in the given directory
# and searching parent directories until it is found, or we go outside the
Expand Down

0 comments on commit 3c70073

Please sign in to comment.