File tree Expand file tree Collapse file tree
htmlSanityCheck-cli/src/main/groovy/org/aim42/htmlsanitycheck/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,6 @@ class HscCommand implements Runnable {
105105 File [] srcDocs
106106
107107 static void main (String [] args ) {
108-
109108 HscRunner hscRunner = new HscRunner ()
110109 HscCommand hscCommand = new HscCommand (hscRunner)
111110 CommandLine cmd = new CommandLine (hscCommand)
@@ -114,13 +113,24 @@ class HscCommand implements Runnable {
114113 cmd. execute(args)
115114 }
116115
117- private List<File > findFiles () throws IOException {
118- Files . walk(Paths . get(srcDir. getPath()))
119- .filter(Files ::isRegularFile)
120- .filter({ path ->
121- suffixes. any { suffix -> path. toString(). endsWith(" .${ suffix} " ) }
122- })
123- .collect { Path path -> path. toFile() }
116+ private List<File > findFiles () {
117+ var srcPath = Paths . get(srcDir. getPath())
118+ if (! Files . exists(srcPath)) {
119+ logger. severe(" Source directory or file '${ srcDir} ' does not exist" )
120+ System . exit(2 )
121+ }
122+ try {
123+ return Files . walk(srcPath)
124+ .filter(Files ::isRegularFile)
125+ .filter({ path ->
126+ suffixes. any { suffix -> path. toString(). endsWith(" .${ suffix} " ) }
127+ })
128+ .collect { Path path -> path. toFile() }
129+ } catch (IOException e) {
130+ logger. severe(" Cannot check HTML files in '${ srcDir} ': '${ e} '" )
131+ System . exit(2 )
132+ }
133+ return null
124134 }
125135
126136 static class HscRunner {
You can’t perform that action at this time.
0 commit comments